├── .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
0bye
"`;
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 ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-read-ref-prop-in-render-destructure.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender @compilationMode(infer)
2 | function Component({ref}) {
3 | const value = ref.current;
4 | return {value}
;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-type-provider-hook-name-not-typed-as-hook-namespace.js:
--------------------------------------------------------------------------------
1 | import ReactCompilerTest from 'ReactCompilerTest';
2 |
3 | function Component() {
4 | return ReactCompilerTest.useHookNotTypedAsHook();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.modify-state-2.js:
--------------------------------------------------------------------------------
1 | import {useState} from 'react';
2 |
3 | function Foo() {
4 | const [state, setState] = useState({foo: {bar: 3}});
5 | const foo = state.foo;
6 | foo.bar = 1;
7 | return state;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.reassignment-to-global-indirect.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const foo = () => {
3 | // Cannot assign to globals
4 | someUnknownGlobal = true;
5 | moduleLocal = true;
6 | };
7 | foo();
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-skip-components-without-hooks-or-jsx.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | // This component is skipped bc it doesn't call any hooks or
3 | // use JSX:
4 | function Component(props) {
5 | return render();
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/memoize-value-block-value-sequence.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x;
3 | (x = []), null;
4 | return x;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Foo,
9 | params: [{}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = {};
3 | if (someVal) {
4 | x = {b};
5 | } else {
6 | x = {c};
7 | }
8 |
9 | x.f = 1;
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-alias-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = 'foo';
3 | if (a) {
4 | x = 'bar';
5 | } else {
6 | x = 'baz';
7 | }
8 | let y = x;
9 | mutate(y);
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender:false
2 | function Foo({a}) {
3 | const ref = useRef();
4 | const x = {a, val: ref.current};
5 |
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-object-pattern.js:
--------------------------------------------------------------------------------
1 | function component(t) {
2 | let {a} = t;
3 | let y = {a};
4 | return y;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: component,
9 | params: [{a: 42}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-0e2214abc294.js:
--------------------------------------------------------------------------------
1 | // Valid because exceptions abort rendering
2 | function RegressionTest() {
3 | if (page == null) {
4 | throw new Error('oh no!');
5 | }
6 | useState();
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-acb56658fe7e.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | class C {
5 | m() {
6 | This.useHook();
7 | Super.useHook();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-f6f37b63b2d4:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | Hook.useState();
5 | Hook._useState();
6 | Hook.use42();
7 | Hook.useHook();
8 | Hook.use_hook();
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequence-expression.js:
--------------------------------------------------------------------------------
1 | function sequence(props) {
2 | let x = (null, Math.max(1, 2), foo());
3 | while ((foo(), true)) {
4 | x = (foo(), 2);
5 | }
6 | return x;
7 | }
8 |
9 | function foo() {}
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/simple-scope.js:
--------------------------------------------------------------------------------
1 | function foo(a) {
2 | const x = [a.b];
3 | return x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: foo,
8 | params: ['TodoAdd'],
9 | isComponent: 'TodoAdd',
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-alias-fields.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = {};
3 | let p = {};
4 | let q = {};
5 | let y = {};
6 |
7 | x.y = y;
8 | p.y = x.y;
9 | q.y = p.y;
10 |
11 | mutate(q);
12 | }
13 |
--------------------------------------------------------------------------------
/fixtures/fiber-debugger/src/index.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | height: 100vh;
6 | cursor: -webkit-grab; cursor: -moz-grab;
7 | }
8 |
9 | #root {
10 | height: 100vh;
11 | }
12 |
13 | * {
14 | box-sizing: border-box;
15 | }
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-14/jsx-runtime.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.production.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-15/jsx-runtime.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.production.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-16/jsx-runtime.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.production.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-17/jsx-runtime.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.production.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/prod/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "webpack-alias-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/eslint-plugin-react-hooks/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export * from './src/index';
9 |
--------------------------------------------------------------------------------
/packages/react-debug-tools/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export * from './src/ReactDebugTools';
9 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/EditableName.css:
--------------------------------------------------------------------------------
1 | .Input {
2 | flex: 0 1 auto;
3 | box-shadow: 0px 1px 3px transparent;
4 | color: var(--color-text);
5 | }
6 | .Input:focus {
7 | color: var(--color-text);
8 | box-shadow: 0px 1px 3px var(--color-shadow);
9 | }
--------------------------------------------------------------------------------
/packages/react-dom/npm/react-dom.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-dom.react-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-dom.react-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-noop-renderer-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-noop-renderer-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-reconciler/npm/constants.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-reconciler-constants.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-reconciler-constants.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-refresh/runtime.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export * from './src/ReactFreshRuntime';
9 |
--------------------------------------------------------------------------------
/packages/use-sync-external-store/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/use-sync-external-store.production.js');
5 | } else {
6 | module.exports = require('./cjs/use-sync-external-store.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/scripts/print-warnings/README.md:
--------------------------------------------------------------------------------
1 | We use this script to extract all messages from `warning()` calls. They don't get substituted with anything in the source or the build. We only do this so we can have a copy of these messages in our internal repository and can spot accidental changes to them.
2 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/expression-with-assignment.js:
--------------------------------------------------------------------------------
1 | function f() {
2 | let x = 1;
3 | return x + (x = 2) + x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: f,
8 | params: [],
9 | isComponent: false,
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-React-namespace.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const [x, setX] = React.useState(1);
3 | return x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: Component,
8 | params: [],
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-React-memo-gating.js:
--------------------------------------------------------------------------------
1 | // @gating @compilationMode(infer)
2 | import React from 'react';
3 | export default React.forwardRef(function notNamedLikeAComponent(props) {
4 | return ;
5 | });
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = someObj();
3 | if (a) {
4 | x = someObj();
5 | } else {
6 | x = someObj();
7 | }
8 |
9 | x.f = 1;
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-method-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject(props);
3 | const y = makeObject(props);
4 | const z = x.optionalMethod?.(y.a, props.a, foo(y.b), bar(props.b));
5 | return z;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-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: 'bar'}],
8 | };
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-33a6e23edac1.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | // Valid because hooks can use hooks.
3 | function createHook() {
4 | return function useHookWithHook() {
5 | useHook();
6 | };
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const {
4 | joe: {foo},
5 | bar,
6 | } = useContext(MyContext);
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unused-logical-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const obj2 = makeObject();
5 | const _ = (obj.a ?? obj2.b) || props.c;
6 | return null;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/scripts/release/shared/packages.js:
--------------------------------------------------------------------------------
1 | const PUBLISHABLE_PACKAGES = [
2 | 'babel-plugin-react-compiler',
3 | 'eslint-plugin-react-compiler',
4 | 'react-compiler-healthcheck',
5 | 'react-compiler-runtime',
6 | ];
7 |
8 | module.exports = {
9 | PUBLISHABLE_PACKAGES,
10 | };
11 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/dev/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | requirejs@^2.3.2:
6 | version "2.3.5"
7 | resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.5.tgz#617b9acbbcb336540ef4914d790323a8d4b861b0"
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/prod/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | requirejs@^2.3.2:
6 | version "2.3.5"
7 | resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.5.tgz#617b9acbbcb336540ef4914d790323a8d4b861b0"
8 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.css:
--------------------------------------------------------------------------------
1 | .NewKeyValue {
2 | white-space: nowrap;
3 | display: flex;
4 | align-items: center;
5 | }
6 |
7 | .EditableName {
8 | margin-left: 1rem;
9 | }
10 |
11 | .EditableValue {
12 | min-width: 1rem;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/react-reconciler/npm/reflection.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-reconciler-reflection.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-reconciler-reflection.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/scripts/perf-counters/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "perf-counters",
3 | "version": "0.1.2",
4 | "description": "Lightweight bindings to Linux perf event counters.",
5 | "main": "index.js",
6 | "license": "MIT",
7 | "dependencies": {
8 | "bindings": "^1.2.1"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-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/change-detect-reassign.js:
--------------------------------------------------------------------------------
1 | // @enableChangeDetectionForDebugging
2 | function Component(props) {
3 | let x = null;
4 | if (props.cond) {
5 | x = [];
6 | x.push(props.value);
7 | }
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/do-while-conditional-break.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = [0, 1, 2, 3];
3 | do {
4 | if (x === 0) {
5 | break;
6 | }
7 | mutate(x);
8 | } while (props.cond);
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-props-via-for-of-iterator.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const items = [];
3 | for (const x of props.items) {
4 | x.modified = true;
5 | items.push(x);
6 | }
7 | return items;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutation-in-closure.js:
--------------------------------------------------------------------------------
1 | function useInvalidMutation(options) {
2 | function test() {
3 | foo(options.foo); // error should not point on this line
4 | options.foo = 'bar';
5 | }
6 | return test;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-read-ref-prop-in-render-property-load.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender @compilationMode(infer)
2 | function Component(props) {
3 | const value = props.ref.current;
4 | return {value}
;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-write-ref-prop-in-render.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender @compilationMode(infer)
2 | function Component(props) {
3 | const ref = props.ref;
4 | ref.current = true;
5 | return {value}
;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/memoize-value-block-value-logical.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x;
3 | true && ((x = []), null);
4 | return x;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Foo,
9 | params: [{}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-receiver-method-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeOptionalObject(props);
3 | const y = makeObject(props);
4 | const z = x?.method(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/rules-of-hooks/rules-of-hooks-dfde14171fcd.js:
--------------------------------------------------------------------------------
1 | // Valid because classes can call functions.
2 | // We don't consider these to be hooks.
3 | class C {
4 | m() {
5 | this.useHook();
6 | super.useHook();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.bail.rules-of-hooks-279ac76f53af.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Unsupported input
3 |
4 | // Valid -- this is a regression test.
5 | jest.useFakeTimers();
6 | beforeEach(() => {
7 | jest.useRealTimers();
8 | });
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx.js:
--------------------------------------------------------------------------------
1 | function foo() {}
2 |
3 | function Component(props) {
4 | const a = [];
5 | const b = {};
6 | foo(a, b);
7 | let _ = ;
8 | foo(a, b);
9 | return ;
10 | }
11 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-14/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.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-15/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.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-16/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.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-17/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.min.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/nesting/src/modern/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "react-nesting-example-modern",
4 | "dependencies": {
5 | "react": "0.0.0-3d0895557",
6 | "react-dom": "0.0.0-3d0895557",
7 | "react-redux": "7.2.1",
8 | "react-router-dom": "5.2.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/react-client/README.md:
--------------------------------------------------------------------------------
1 | # react-client
2 |
3 | This is an experimental package for consuming custom React streaming models.
4 |
5 | **Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.**
6 |
7 | **Use it at your own risk.**
8 |
--------------------------------------------------------------------------------
/packages/react-debug-tools/README.md:
--------------------------------------------------------------------------------
1 | # react-debug-tools
2 |
3 | This is an experimental package for debugging React renderers.
4 |
5 | **Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.**
6 |
7 | **Use it at your own risk.**
8 |
--------------------------------------------------------------------------------
/packages/react-markup/npm/react-markup.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-markup.react-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-markup.react-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-refresh/babel.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export {default} from './src/ReactFreshBabelPlugin';
9 |
--------------------------------------------------------------------------------
/packages/react-test-renderer/npm/shallow.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | function ReactShallowRenderer() {
4 | throw new Error(
5 | 'react-test-renderer/shallow has been removed. See https://react.dev/warnings/react-test-renderer.'
6 | );
7 | }
8 |
9 | module.exports = ReactShallowRenderer;
10 |
--------------------------------------------------------------------------------
/packages/scheduler/npm/unstable_post_task.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/scheduler-unstable_post_task.production.js');
5 | } else {
6 | module.exports = require('./cjs/scheduler-unstable_post_task.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/apps/playground/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "headers": [
3 | {
4 | "source": "/fonts/(.*).woff2",
5 | "headers": [
6 | {
7 | "key": "Cache-Control",
8 | "value": "public, max-age=31536000, immutable"
9 | }
10 | ]
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeFunction(props);
3 | const y = x(
4 |
5 | {props.text}
6 |
7 | );
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constructor.js:
--------------------------------------------------------------------------------
1 | function Foo() {}
2 |
3 | function Component(props) {
4 | const a = [];
5 | const b = {};
6 | new Foo(a, b);
7 | let _ = ;
8 | new Foo(b);
9 | return ;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-array-param-default.js:
--------------------------------------------------------------------------------
1 | function Component([a = 2]) {
2 | return a;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Component,
7 | params: ['TodoAdd'],
8 | isComponent: 'TodoAdd',
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-object-param-default.js:
--------------------------------------------------------------------------------
1 | function Component({a = 2}) {
2 | return a;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Component,
7 | params: ['TodoAdd'],
8 | isComponent: 'TodoAdd',
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-conditional-call-aliased-react-hook.js:
--------------------------------------------------------------------------------
1 | import {useState as state} from 'react';
2 |
3 | function Component(props) {
4 | let s;
5 | if (props.cond) {
6 | [s] = state();
7 | }
8 | return s;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-jsx-in-try-with-catch.js:
--------------------------------------------------------------------------------
1 | // @validateNoJSXInTryStatements
2 | function Component(props) {
3 | let el;
4 | try {
5 | el = ;
6 | } catch {
7 | return null;
8 | }
9 | return el;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-function-expression-references-later-variable-declaration.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let callback = () => {
3 | onClick = () => {};
4 | };
5 | let onClick;
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/memoize-value-block-value-conditional.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x;
3 | true ? (x = []) : (x = {});
4 | return x;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Foo,
9 | params: [{}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/memoize-value-block-value-logical-no-sequence.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x;
3 | true && (x = []);
4 | return x;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Foo,
9 | params: [{}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nested-optional-member-expr.js:
--------------------------------------------------------------------------------
1 | // We should codegen nested optional properties correctly
2 | // (i.e. placing `?` in the correct PropertyLoad)
3 | function Component(props) {
4 | let x = foo(props.a?.b.c.d);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reactive-dependencies-non-optional-properties-inside-optional-chain.js:
--------------------------------------------------------------------------------
1 | // @enablePropagateDepsInHIR
2 | function Component(props) {
3 | return props.post.feedback.comments?.edges?.map(render);
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-method-call.js:
--------------------------------------------------------------------------------
1 | let x = {};
2 | function Component() {
3 | React.useEffect(() => {
4 | x.foo = 1;
5 | });
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: Component,
10 | params: [],
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/react-compiler-runtime/README.md:
--------------------------------------------------------------------------------
1 | # react-compiler-runtime
2 |
3 | Backwards compatible shim for runtime APIs used by React Compiler. Primarily meant for React versions prior to 19, but it will also work on > 19.
4 |
5 | See also https://github.com/reactwg/react-compiler/discussions/6.
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-inline/src/hookNames.js:
--------------------------------------------------------------------------------
1 | /** @flow */
2 |
3 | import {
4 | parseHookNames,
5 | parseSourceAndMetadata,
6 | purgeCachedMetadata,
7 | } from 'react-devtools-shared/src/hooks/parseHookNames';
8 |
9 | export {parseHookNames, parseSourceAndMetadata, purgeCachedMetadata};
10 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/npm/persistent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-noop-renderer-persistent.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-noop-renderer-persistent.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react/npm/jsx-runtime.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.react-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.react-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/use-sync-external-store/npm/shim/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('../cjs/use-sync-external-store-shim.production.js');
5 | } else {
6 | module.exports = require('../cjs/use-sync-external-store-shim.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/const-propagation-into-function-expression-global.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const isX = GLOBAL_IS_X;
3 | const getJSX = () => {
4 | return ;
5 | };
6 | const result = getJSX();
7 | return result;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dce-unused-postfix-update.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let i = 0;
3 | i++;
4 | i = props.i;
5 | return i;
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: Component,
10 | params: [{i: 42}],
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dce-unused-prefix-update.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let i = 0;
3 | --i;
4 | i = props.i;
5 | return i;
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: Component,
10 | params: [{i: 42}],
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.js:
--------------------------------------------------------------------------------
1 | function foo({data: dataTestID}) {
2 | return dataTestID;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: foo,
7 | params: [{data: {}}],
8 | isComponent: false,
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/holey-array-pattern-dce.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let [, foo, bar] = props;
3 | return foo;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: t,
8 | params: ['TodoAdd'],
9 | isComponent: 'TodoAdd',
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-declaration-basic.flow.js:
--------------------------------------------------------------------------------
1 | // @flow @compilationMode(infer)
2 | export default hook useFoo(bar: number) {
3 | return [bar];
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: useFoo,
8 | params: [42],
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/property-assignment.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = {};
3 | const y = [];
4 | x.y = y;
5 | const child = ;
6 | x.y.push(props.p0);
7 | return {child};
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const items = bar();
3 | mutate(items.a, props.a);
4 |
5 | const count = foo(items.length + 1);
6 |
7 | return {items, count};
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-dynamic-hook-via-hooklike-local.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const someFunction = useContext(FooContext);
3 | const useOhItsNamedLikeAHookNow = someFunction;
4 | useOhItsNamedLikeAHookNow();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2bec02ac982b.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | // Valid because hooks can call hooks.
3 | function createHook() {
4 | return function useHook() {
5 | useHook1();
6 | useHook2();
7 | };
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-8303403b8e4c.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | class ClassComponentWithHook extends React.Component {
5 | render() {
6 | React.useState();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.js:
--------------------------------------------------------------------------------
1 | function foo(a) {
2 | const x = {};
3 | if (a) {
4 | let y = {};
5 | x.y = y;
6 | } else {
7 | let z = {};
8 | x.z = z;
9 | }
10 | mutate(x);
11 | return x;
12 | }
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | return y;
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: foo,
10 | params: [],
11 | isComponent: false,
12 | };
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-throw.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | if (x === 1) {
4 | x = 2;
5 | }
6 | throw x;
7 | }
8 |
9 | export const FIXTURE_ENTRYPOINT = {
10 | fn: foo,
11 | params: [],
12 | isComponent: false,
13 | };
14 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/target-flag.js:
--------------------------------------------------------------------------------
1 | // @target="18"
2 |
3 | function Component() {
4 | return Hello world
;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Component,
9 | params: [],
10 | isComponent: true,
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-field-load.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = {t: 1};
3 | let p = x.t;
4 | return p;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: component,
9 | params: [],
10 | isComponent: false,
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-test-primitive.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = 1;
3 | let y = 2;
4 |
5 | return y;
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: component,
10 | params: [],
11 | isComponent: false,
12 | };
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-pruned-dependency-change-detect.js:
--------------------------------------------------------------------------------
1 | // @enableChangeDetectionForDebugging
2 | import {useState} from 'react';
3 |
4 | function Component(props) {
5 | const [x, _] = useState(f(props.x));
6 | return {x}
;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/while-break.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | while (a) {
3 | break;
4 | }
5 | return b;
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: foo,
10 | params: ['TodoAdd'],
11 | isComponent: 'TodoAdd',
12 | };
13 |
--------------------------------------------------------------------------------
/fixtures/eslint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "eslint-playground",
4 | "dependencies": {
5 | "eslint": "4.1.0",
6 | "eslint-plugin-react-hooks": "link:./proxy"
7 | },
8 | "scripts": {
9 | "start": "./watch.sh",
10 | "lint": "eslint index.js"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/react-art/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './src/ReactART';
11 |
--------------------------------------------------------------------------------
/packages/react-dom/server.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './server.node';
11 |
--------------------------------------------------------------------------------
/packages/react-dom/static.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './static.node';
11 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/client.node.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-server-dom-esm-client.node.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-server-dom-esm-client.node.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/scripts/git/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # To enable this hook, symlink or copy this file to .git/hooks/pre-commit.
4 |
5 | # Redirect output to stderr.
6 | exec 1>&2
7 |
8 | git diff --cached --name-only --diff-filter=ACMRTUB | \
9 | grep '\.js$' | \
10 | xargs ./node_modules/.bin/eslint --
11 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_size = 2
8 | indent_style = space
9 | insert_final_newline = true
10 | max_line_length = 80
11 |
12 | [*.md]
13 | max_line_length = 0
14 |
15 | [COMMIT_EDITMSG]
16 | max_line_length = 0
17 |
--------------------------------------------------------------------------------
/compiler/apps/playground/hooks/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export {default as useMountEffect} from './useMountEffect';
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | // a's mutable range should be limited
3 | // the following line
4 | let a = someObj();
5 |
6 | let x = [];
7 | x.push(a);
8 |
9 | return [x, a];
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = {a};
3 | let y = {};
4 | const f0 = function () {
5 | let a = y;
6 | a.x = x;
7 | };
8 | f0();
9 | mutate(y);
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.js:
--------------------------------------------------------------------------------
1 | // @enableEmitFreeze true
2 |
3 | function MyComponentName(props) {
4 | let x = {};
5 | foo(x, props.a);
6 | foo(x, props.b);
7 |
8 | let y = [];
9 | y.push(x);
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-string-literal-property-key.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const {data: t} = {data: 1};
3 | return t;
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/error.invalid-mutate-after-freeze.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = [];
3 |
4 | let _ = ;
5 |
6 | // x is Frozen at this point
7 | x.push(props.p2);
8 |
9 | return {_}
;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-logical-expression-within-try-catch.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let result;
3 | try {
4 | result = props.cond && props.foo;
5 | } catch (e) {
6 | console.log(e);
7 | }
8 | return result;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.update-global-should-bailout.tsx:
--------------------------------------------------------------------------------
1 | let renderCount = 0;
2 | function useFoo() {
3 | renderCount += 1;
4 | return renderCount;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: useFoo,
9 | params: [],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/expression-with-assignment-dynamic.js:
--------------------------------------------------------------------------------
1 | function f(y) {
2 | let x = y;
3 | return x + (x = 2) + x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: f,
8 | params: ['TodoAdd'],
9 | isComponent: 'TodoAdd',
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/holey-array-pattern-dce-2.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let [foo, bar, ,] = props;
3 | return foo;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: t,
8 | params: ['TodoAdd'],
9 | isComponent: 'TodoAdd',
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-functions-component-with-ref-arg.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 |
3 | function Foo({}, ref) {
4 | return ;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Foo,
9 | params: [{}],
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/multi-directive.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | 'use foo';
3 | 'use bar';
4 | return "foo"
;
5 | }
6 |
7 | export const FIXTURE_ENTRYPOINT = {
8 | fn: Component,
9 | params: [],
10 | isComponent: true,
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-receiver-optional-method.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeOptionalObject(props);
3 | const y = makeObject(props);
4 | const z = x?.optionalMethod?.(y.a, props.a, foo(y.b), bar(props.b));
5 | return z;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender:false
2 | function Foo({a}) {
3 | const ref = useRef();
4 | const val = ref.current;
5 | const x = {a, val};
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-8f1c2c3f71c9.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | // Valid because components can use hooks.
3 | function createComponentWithHook() {
4 | return function ComponentWithHook() {
5 | useHook();
6 | };
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-global-propertyload-case-test.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | switch (props.value) {
3 | case Global.Property: {
4 | return true;
5 | }
6 | default: {
7 | return false;
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.js:
--------------------------------------------------------------------------------
1 | function component(props) {
2 | // NOTE: the temporary for the leading space was previously dropped
3 | const x = isMenuShown ? {props.a ? props.b : props.c} : null;
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const context = useContext(MyContext);
4 | const [foo] = context;
5 | const {bar} = context;
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const context = useContext(MyContext);
4 | const foo = context.foo;
5 | const bar = context.bar;
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unused-object-element.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | const {x, y, ...z} = props.a;
3 | return x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: Foo,
8 | params: ['TodoAdd'],
9 | isComponent: 'TodoAdd',
10 | };
11 |
--------------------------------------------------------------------------------
/packages/jest-react/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | 'use strict';
9 |
10 | export * from './src/JestReact';
11 |
--------------------------------------------------------------------------------
/packages/react-art/Circle.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export {default} from './npm/Circle';
11 |
--------------------------------------------------------------------------------
/packages/react-art/Wedge.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export {default} from './npm/Wedge';
11 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/README.md:
--------------------------------------------------------------------------------
1 | The JavaScript source files in this directory are not linted or pre-processed in any way. This is intentional, since they are used by the `parseHookNames-test` to test the behavior of "uncompiled" JavaScript (without source maps).
--------------------------------------------------------------------------------
/packages/react-dom/unstable_testing.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './client.js';
11 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/npm/flight-client.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-noop-renderer-flight-client.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-noop-renderer-flight-client.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/npm/flight-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-noop-renderer-flight-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-noop-renderer-flight-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react/npm/jsx-dev-runtime.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-dev-runtime.react-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-dev-runtime.react-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/use-sync-external-store/README.md:
--------------------------------------------------------------------------------
1 | # use-sync-external-store
2 |
3 | Backwards-compatible shim for [`React.useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). Works with any React that supports Hooks.
4 |
5 | See also https://github.com/reactwg/react-18/discussions/86.
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const [x = [-1, 1]] = props.value;
3 | return x;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: Component,
8 | params: [{value: []}],
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | function Component() {
3 | return ;
4 |
5 | // This is unreachable from a control-flow perspective, but it gets hoisted
6 | function Foo() {}
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-invalid-jsx-in-try-with-finally.js:
--------------------------------------------------------------------------------
1 | // @validateNoJSXInTryStatements
2 | function Component(props) {
3 | let el;
4 | try {
5 | el = ;
6 | } finally {
7 | console.log(el);
8 | }
9 | return el;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.ts:
--------------------------------------------------------------------------------
1 | function Foo() {
2 | type X = number;
3 | interface Bar {
4 | baz: number;
5 | }
6 | return 0;
7 | }
8 |
9 | export const FIXTURE_ENTRYPOINT = {
10 | fn: Foo,
11 | params: [],
12 | };
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const x = {};
3 | {
4 | const x = [];
5 | const fn = function () {
6 | mutate(x);
7 | };
8 | fn();
9 | }
10 | return x; // should return {}
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const items = bar();
3 | mutate(items[props.key], props.a);
4 |
5 | const count = foo(items.length + 1);
6 |
7 | return {items, count};
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/recursive-function.js:
--------------------------------------------------------------------------------
1 | function foo(x) {
2 | if (x <= 0) {
3 | return 0;
4 | }
5 | return x + foo(x - 1) + (() => foo(x - 2))();
6 | }
7 |
8 | export const FIXTURE_ENTRYPOINT = {
9 | fn: foo,
10 | params: [10],
11 | };
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-eacfcaa6ef89.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can be used in anonymous function arguments to
2 | // memo.
3 | const MemoizedFunction = memo(function (props) {
4 | useHook();
5 | return ;
6 | });
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-return.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | if (x === 1) {
4 | x = 2;
5 | }
6 |
7 | return x;
8 | }
9 |
10 | export const FIXTURE_ENTRYPOINT = {
11 | fn: foo,
12 | params: [],
13 | isComponent: false,
14 | };
15 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-shadowing.js:
--------------------------------------------------------------------------------
1 | function log() {}
2 |
3 | function Foo(cond) {
4 | let str = '';
5 | if (cond) {
6 | let str = 'other test';
7 | log(str);
8 | } else {
9 | str = 'fallthrough test';
10 | }
11 | log(str);
12 | }
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/template-literal.js:
--------------------------------------------------------------------------------
1 | function componentA(props) {
2 | let t = `hello ${props.a}, ${props.b}!`;
3 | t += ``;
4 | return t;
5 | }
6 |
7 | function componentB(props) {
8 | let x = useFoo(`hello ${props.a}`);
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const context = useContext(MyContext);
4 | const {foo} = context;
5 | const {bar} = context;
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useMemo(() => {
3 | if (props.cond) {
4 | return makeObject(props.a);
5 | }
6 | return makeObject(props.b);
7 | });
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/react-art/Rectangle.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export {default} from './npm/Rectangle';
11 |
--------------------------------------------------------------------------------
/packages/react-client/flight.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './src/ReactFlightClient';
11 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/src/main/debounce.js:
--------------------------------------------------------------------------------
1 | function debounce(fn, timeout) {
2 | let executionTimeoutId = null;
3 |
4 | return (...args) => {
5 | clearTimeout(executionTimeoutId);
6 | executionTimeoutId = setTimeout(fn, timeout, ...args);
7 | };
8 | }
9 |
10 | export default debounce;
11 |
--------------------------------------------------------------------------------
/packages/react-devtools-shell/src/app/ToDoList/List.css:
--------------------------------------------------------------------------------
1 | .Input {
2 | font-size: 1rem;
3 | padding: 0.25rem;
4 | }
5 |
6 | .IconButton {
7 | padding: 0.25rem;
8 | border: none;
9 | background: none;
10 | cursor: pointer;
11 | }
12 |
13 | .List {
14 | margin: 0.5rem 0 0;
15 | padding: 0;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/react-markup/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './src/ReactMarkupClient';
11 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './src/ReactNoop';
11 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/client.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | *
7 | * @flow
8 | */
9 |
10 | export * from './client.browser';
11 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/client.browser.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-server-dom-esm-client.browser.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-server-dom-esm-client.browser.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/npm/client.edge.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-server-dom-parcel-client.edge.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-server-dom-parcel-client.edge.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/npm/client.node.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-server-dom-parcel-client.node.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-server-dom-parcel-client.node.development.js');
7 | }
8 |
--------------------------------------------------------------------------------