├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── React16源码阅读总结流程图.svg ├── fixtures ├── art │ ├── .gitignore │ ├── README.md │ ├── VectorWidget.js │ ├── app.js │ ├── index.html │ ├── package.json │ ├── webpack.config.js │ └── yarn.lock ├── attribute-behavior │ ├── .gitignore │ ├── AttributeTableSnapshot.md │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ ├── src │ │ ├── App.js │ │ ├── App.test.js │ │ ├── attributes.js │ │ ├── index.css │ │ └── index.js │ └── yarn.lock ├── dom │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ │ ├── act-dom.html │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── react-logo.svg │ │ ├── renderer.html │ │ ├── renderer.js │ │ └── test.mp4 │ ├── src │ │ ├── components │ │ │ ├── App.js │ │ │ ├── Fixture.js │ │ │ ├── FixtureSet.js │ │ │ ├── Header.js │ │ │ ├── Iframe.js │ │ │ ├── IssueList.js │ │ │ ├── TestCase.js │ │ │ ├── VersionPicker.js │ │ │ ├── fixtures │ │ │ │ ├── buttons │ │ │ │ │ └── index.js │ │ │ │ ├── custom-elements │ │ │ │ │ └── index.js │ │ │ │ ├── date-inputs │ │ │ │ │ ├── index.js │ │ │ │ │ └── switch-date-test-case.js │ │ │ │ ├── error-handling │ │ │ │ │ └── index.js │ │ │ │ ├── event-pooling │ │ │ │ │ ├── hit-box.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── mouse-move.js │ │ │ │ │ └── persistence.js │ │ │ │ ├── home.js │ │ │ │ ├── hydration │ │ │ │ │ ├── Code.js │ │ │ │ │ ├── code-transformer.js │ │ │ │ │ ├── codemirror-paraiso-dark.css │ │ │ │ │ ├── data.js │ │ │ │ │ ├── hydration.css │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── input-change-events │ │ │ │ │ ├── InputPlaceholderFixture.js │ │ │ │ │ ├── RadioClickFixture.js │ │ │ │ │ ├── RadioGroupFixture.js │ │ │ │ │ ├── RadioNameChangeFixture.js │ │ │ │ │ ├── RangeKeyboardFixture.js │ │ │ │ │ └── index.js │ │ │ │ ├── media-events │ │ │ │ │ └── index.js │ │ │ │ ├── mouse-events │ │ │ │ │ ├── index.js │ │ │ │ │ └── mouse-movement.js │ │ │ │ ├── number-inputs │ │ │ │ │ ├── NumberInputDecimal.js │ │ │ │ │ ├── NumberInputExtraZeroes.js │ │ │ │ │ ├── NumberTestCase.js │ │ │ │ │ └── index.js │ │ │ │ ├── password-inputs │ │ │ │ │ ├── PasswordTestCase.js │ │ │ │ │ └── index.js │ │ │ │ ├── pointer-events │ │ │ │ │ ├── drag-box.js │ │ │ │ │ ├── drag.js │ │ │ │ │ ├── hover-box.js │ │ │ │ │ ├── hover.js │ │ │ │ │ └── index.js │ │ │ │ ├── range-inputs │ │ │ │ │ └── index.js │ │ │ │ ├── selection-events │ │ │ │ │ ├── OnSelectEventTestCase.js │ │ │ │ │ ├── ReorderedInputsTestCase.js │ │ │ │ │ └── index.js │ │ │ │ ├── selects │ │ │ │ │ └── index.js │ │ │ │ ├── suspense │ │ │ │ │ └── index.js │ │ │ │ ├── text-inputs │ │ │ │ │ ├── InputTestCase.js │ │ │ │ │ ├── README.md │ │ │ │ │ ├── ReplaceEmailInput.js │ │ │ │ │ └── index.js │ │ │ │ └── textareas │ │ │ │ │ └── index.js │ │ │ └── propTypes.js │ │ ├── find-dom-node.js │ │ ├── index.js │ │ ├── polyfills.js │ │ ├── react-loader.js │ │ ├── style.css │ │ └── tags.js │ └── yarn.lock ├── eslint │ ├── .eslintrc.json │ ├── README.md │ ├── index.js │ ├── package.json │ ├── proxy │ │ ├── index.js │ │ └── package.json │ ├── watch.sh │ └── yarn.lock ├── expiration │ ├── .gitignore │ ├── package.json │ ├── public │ │ └── index.html │ ├── src │ │ └── index.js │ └── yarn.lock ├── fiber-debugger │ ├── .env │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── src │ │ ├── App.js │ │ ├── Editor.js │ │ ├── Fibers.js │ │ ├── describeFibers.js │ │ ├── index.css │ │ └── index.js │ └── yarn.lock ├── fiber-triangle │ └── index.html ├── fizz-ssr-browser │ └── index.html ├── packaging │ ├── README.md │ ├── babel-standalone │ │ └── dev.html │ ├── browserify │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ ├── brunch │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ │ └── initialize.js │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ └── initialize.js │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ ├── build-all.js │ ├── globals │ │ ├── dev.html │ │ └── prod.html │ ├── index.html │ ├── requirejs │ │ ├── dev.html │ │ └── prod.html │ ├── rjs │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ ├── systemjs-builder │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── build.js │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── build.js │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ ├── systemjs │ │ ├── dev.html │ │ └── prod.html │ ├── webpack-alias │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── config.js │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ └── webpack │ │ ├── dev │ │ ├── .gitignore │ │ ├── config.js │ │ ├── index.html │ │ ├── input.js │ │ ├── package.json │ │ └── yarn.lock │ │ └── prod │ │ ├── .gitignore │ │ ├── config.js │ │ ├── index.html │ │ ├── input.js │ │ ├── package.json │ │ └── yarn.lock ├── scheduler │ └── index.html ├── ssr │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── server │ │ ├── index.js │ │ └── render.js │ ├── src │ │ ├── components │ │ │ ├── App.js │ │ │ ├── Chrome.css │ │ │ ├── Chrome.js │ │ │ ├── Page.css │ │ │ ├── Page.js │ │ │ ├── Page2.js │ │ │ ├── Suspend.js │ │ │ └── Theme.js │ │ └── index.js │ └── yarn.lock ├── tracing │ ├── index.html │ ├── script.js │ ├── test.html │ └── test.js ├── unstable-async │ └── time-slicing │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ │ ├── src │ │ ├── Charts.js │ │ ├── Clock.js │ │ ├── index.css │ │ └── index.js │ │ └── yarn.lock └── unstable-fire │ └── index.html ├── index.html ├── package-lock.json ├── package.json ├── packages ├── create-subscription │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── __tests__ │ │ └── createSubscription-test.internal.js │ │ └── createSubscription.js ├── eslint-plugin-react-hooks │ ├── README.md │ ├── __tests__ │ │ ├── ESLintRuleExhaustiveDeps-test.js │ │ └── ESLintRulesOfHooks-test.js │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ExhaustiveDeps.js │ │ ├── RulesOfHooks.js │ │ └── index.js ├── events │ ├── EventBatching.js │ ├── EventPluginHub.js │ ├── EventPluginRegistry.js │ ├── EventPluginUtils.js │ ├── EventPropagators.js │ ├── EventSystemFlags.js │ ├── EventTypes.js │ ├── PluginModuleType.js │ ├── ReactControlledComponent.js │ ├── ReactGenericBatching.js │ ├── ReactSyntheticEventType.js │ ├── ResponderEventPlugin.js │ ├── ResponderSyntheticEvent.js │ ├── ResponderTopLevelEventTypes.js │ ├── ResponderTouchHistoryStore.js │ ├── SyntheticEvent.js │ ├── TopLevelEventTypes.js │ ├── __tests__ │ │ ├── EventPluginRegistry-test.internal.js │ │ ├── ResponderEventPlugin-test.internal.js │ │ └── accumulateInto-test.internal.js │ ├── accumulate.js │ ├── accumulateInto.js │ ├── forEachAccumulated.js │ ├── forks │ │ └── ResponderTopLevelEventTypes.dom.js │ └── package.json ├── jest-mock-scheduler │ ├── README.md │ ├── npm │ │ └── index.js │ └── package.json ├── jest-react │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ └── JestReact.js ├── react-art │ ├── Circle.js │ ├── README.md │ ├── Rectangle.js │ ├── Wedge.js │ ├── index.js │ ├── npm │ │ ├── Circle.js │ │ ├── Rectangle.js │ │ ├── Wedge.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ReactART.js │ │ ├── ReactARTHostConfig.js │ │ ├── ReactARTInternals.js │ │ └── __tests__ │ │ ├── ReactART-test.js │ │ └── __snapshots__ │ │ └── ReactART-test.js.snap ├── react-cache │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── LRU.js │ │ ├── ReactCache.js │ │ └── __tests__ │ │ └── ReactCache-test.internal.js ├── react-debug-tools │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ReactDebugHooks.js │ │ ├── ReactDebugTools.js │ │ └── __tests__ │ │ ├── ReactDevToolsHooksIntegration-test.js │ │ ├── ReactHooksInspection-test.js │ │ └── ReactHooksInspectionIntegration-test.js ├── react-dom │ ├── README.md │ ├── index.fb.js │ ├── index.js │ ├── npm │ │ ├── index.js │ │ ├── profiling.js │ │ ├── server.browser.js │ │ ├── server.js │ │ ├── server.node.js │ │ ├── test-utils.js │ │ ├── unstable-fizz.browser.js │ │ ├── unstable-fizz.js │ │ ├── unstable-fizz.node.js │ │ └── unstable-native-dependencies.js │ ├── package.json │ ├── server.browser.js │ ├── server.js │ ├── server.node.js │ ├── src │ │ ├── __tests__ │ │ │ ├── CSSPropertyOperations-test.js │ │ │ ├── DOMPropertyOperations-test.js │ │ │ ├── EventPluginHub-test.js │ │ │ ├── ReactBrowserEventEmitter-test.internal.js │ │ │ ├── ReactChildReconciler-test.js │ │ │ ├── ReactComponent-test.js │ │ │ ├── ReactComponentLifeCycle-test.js │ │ │ ├── ReactCompositeComponent-test.js │ │ │ ├── ReactCompositeComponentDOMMinimalism-test.js │ │ │ ├── ReactCompositeComponentNestedState-test.js │ │ │ ├── ReactCompositeComponentState-test.js │ │ │ ├── ReactDOM-test.js │ │ │ ├── ReactDOMAttribute-test.js │ │ │ ├── ReactDOMComponent-test.js │ │ │ ├── ReactDOMComponentTree-test.js │ │ │ ├── ReactDOMEventListener-test.js │ │ │ ├── ReactDOMFiber-test.js │ │ │ ├── ReactDOMFiberAsync-test.internal.js │ │ │ ├── ReactDOMFizzServerBrowser-test.js │ │ │ ├── ReactDOMFizzServerNode-test.js │ │ │ ├── ReactDOMHooks-test.internal.js │ │ │ ├── ReactDOMIframe-test.js │ │ │ ├── ReactDOMInput-test.js │ │ │ ├── ReactDOMInvalidARIAHook-test.js │ │ │ ├── ReactDOMOption-test.js │ │ │ ├── ReactDOMRoot-test.js │ │ │ ├── ReactDOMSVG-test.js │ │ │ ├── ReactDOMSelect-test.js │ │ │ ├── ReactDOMSelection-test.internal.js │ │ │ ├── ReactDOMServerIntegrationAttributes-test.js │ │ │ ├── ReactDOMServerIntegrationBasic-test.js │ │ │ ├── ReactDOMServerIntegrationCheckbox-test.js │ │ │ ├── ReactDOMServerIntegrationClassContextType-test.js │ │ │ ├── ReactDOMServerIntegrationElements-test.js │ │ │ ├── ReactDOMServerIntegrationFragment-test.js │ │ │ ├── ReactDOMServerIntegrationHooks-test.internal.js │ │ │ ├── ReactDOMServerIntegrationInput-test.js │ │ │ ├── ReactDOMServerIntegrationLegacyContext-test.js │ │ │ ├── ReactDOMServerIntegrationModes-test.js │ │ │ ├── ReactDOMServerIntegrationNewContext-test.js │ │ │ ├── ReactDOMServerIntegrationReconnecting-test.js │ │ │ ├── ReactDOMServerIntegrationRefs-test.js │ │ │ ├── ReactDOMServerIntegrationSelect-test.js │ │ │ ├── ReactDOMServerIntegrationSpecialTypes-test.js │ │ │ ├── ReactDOMServerIntegrationTextarea-test.js │ │ │ ├── ReactDOMServerIntegrationUntrustedURL-test.internal.js │ │ │ ├── ReactDOMServerIntegrationUserInteraction-test.js │ │ │ ├── ReactDOMServerLifecycles-test.js │ │ │ ├── ReactDOMServerPartialHydration-test.internal.js │ │ │ ├── ReactDOMServerSuspense-test.internal.js │ │ │ ├── ReactDOMShorthandCSSPropertyCollision-test.internal.js │ │ │ ├── ReactDOMSuspensePlaceholder-test.js │ │ │ ├── ReactDOMTextComponent-test.js │ │ │ ├── ReactDOMTextarea-test.js │ │ │ ├── ReactDOMserverIntegrationProgress-test.js │ │ │ ├── ReactEmptyComponent-test.js │ │ │ ├── ReactErrorBoundaries-test.internal.js │ │ │ ├── ReactErrorLoggingRecovery-test.js │ │ │ ├── ReactEventIndependence-test.js │ │ │ ├── ReactFunctionComponent-test.js │ │ │ ├── ReactIdentity-test.js │ │ │ ├── ReactLegacyErrorBoundaries-test.internal.js │ │ │ ├── ReactMockedComponent-test.js │ │ │ ├── ReactMount-test.js │ │ │ ├── ReactMountDestruction-test.js │ │ │ ├── ReactMultiChild-test.js │ │ │ ├── ReactMultiChildReconcile-test.js │ │ │ ├── ReactMultiChildText-test.js │ │ │ ├── ReactRenderDocument-test.js │ │ │ ├── ReactServerRendering-test.js │ │ │ ├── ReactServerRenderingBrowser-test.js │ │ │ ├── ReactServerRenderingHydration-test.js │ │ │ ├── ReactTestUtils-test.js │ │ │ ├── ReactTestUtilsAct-test.js │ │ │ ├── ReactTreeTraversal-test.js │ │ │ ├── ReactUpdates-test.js │ │ │ ├── __snapshots__ │ │ │ │ └── ReactTestUtils-test.js.snap │ │ │ ├── escapeTextForBrowser-test.js │ │ │ ├── findDOMNode-test.js │ │ │ ├── multiple-copies-of-react-test.js │ │ │ ├── quoteAttributeValueForBrowser-test.js │ │ │ ├── refs-destruction-test.js │ │ │ ├── refs-test.js │ │ │ ├── renderSubtreeIntoContainer-test.js │ │ │ ├── utils │ │ │ │ └── ReactDOMServerIntegrationTestUtils.js │ │ │ └── validateDOMNesting-test.js │ │ ├── client │ │ │ ├── DOMPropertyOperations.js │ │ │ ├── ReactDOM.js │ │ │ ├── ReactDOMClientInjection.js │ │ │ ├── ReactDOMComponent.js │ │ │ ├── ReactDOMComponentTree.js │ │ │ ├── ReactDOMFB.js │ │ │ ├── ReactDOMHostConfig.js │ │ │ ├── ReactDOMInput.js │ │ │ ├── ReactDOMOption.js │ │ │ ├── ReactDOMSelect.js │ │ │ ├── ReactDOMSelection.js │ │ │ ├── ReactDOMTextarea.js │ │ │ ├── ReactInputSelection.js │ │ │ ├── ToStringValue.js │ │ │ ├── __tests__ │ │ │ │ ├── dangerouslySetInnerHTML-test.js │ │ │ │ └── getNodeForCharacterOffset-test.js │ │ │ ├── getActiveElement.js │ │ │ ├── getNodeForCharacterOffset.js │ │ │ ├── inputValueTracking.js │ │ │ ├── setInnerHTML.js │ │ │ ├── setTextContent.js │ │ │ └── validateDOMNesting.js │ │ ├── events │ │ │ ├── BeforeInputEventPlugin.js │ │ │ ├── ChangeEventPlugin.js │ │ │ ├── DOMEventPluginOrder.js │ │ │ ├── DOMEventResponderSystem.js │ │ │ ├── DOMTopLevelEventTypes.js │ │ │ ├── EnterLeaveEventPlugin.js │ │ │ ├── EventListener.js │ │ │ ├── FallbackCompositionState.js │ │ │ ├── ReactBrowserEventEmitter.js │ │ │ ├── ReactDOMEventListener.js │ │ │ ├── SelectEventPlugin.js │ │ │ ├── SimpleEventPlugin.js │ │ │ ├── SyntheticAnimationEvent.js │ │ │ ├── SyntheticClipboardEvent.js │ │ │ ├── SyntheticCompositionEvent.js │ │ │ ├── SyntheticDragEvent.js │ │ │ ├── SyntheticFocusEvent.js │ │ │ ├── SyntheticInputEvent.js │ │ │ ├── SyntheticKeyboardEvent.js │ │ │ ├── SyntheticMouseEvent.js │ │ │ ├── SyntheticPointerEvent.js │ │ │ ├── SyntheticTouchEvent.js │ │ │ ├── SyntheticTransitionEvent.js │ │ │ ├── SyntheticUIEvent.js │ │ │ ├── SyntheticWheelEvent.js │ │ │ ├── __tests__ │ │ │ │ ├── BeforeInputEventPlugin-test.js │ │ │ │ ├── ChangeEventPlugin-test.internal.js │ │ │ │ ├── DOMEventResponderSystem-test.internal.js │ │ │ │ ├── EnterLeaveEventPlugin-test.js │ │ │ │ ├── SelectEventPlugin-test.js │ │ │ │ ├── SimpleEventPlugin-test.internal.js │ │ │ │ ├── SyntheticClipboardEvent-test.js │ │ │ │ ├── SyntheticEvent-test.js │ │ │ │ ├── SyntheticKeyboardEvent-test.js │ │ │ │ ├── SyntheticMouseEvent-test.js │ │ │ │ ├── SyntheticWheelEvent-test.js │ │ │ │ └── getEventKey-test.js │ │ │ ├── checkPassiveEvents.js │ │ │ ├── forks │ │ │ │ └── EventListener-www.js │ │ │ ├── getEventCharCode.js │ │ │ ├── getEventKey.js │ │ │ ├── getEventModifierState.js │ │ │ ├── getEventTarget.js │ │ │ ├── getVendorPrefixedEventName.js │ │ │ └── isEventSupported.js │ │ ├── fire │ │ │ ├── ReactFire.js │ │ │ └── ReactFireHostConfig.js │ │ ├── server │ │ │ ├── DOMMarkupOperations.js │ │ │ ├── ReactDOMFizzServerBrowser.js │ │ │ ├── ReactDOMFizzServerFormatConfig.js │ │ │ ├── ReactDOMFizzServerNode.js │ │ │ ├── ReactDOMNodeStreamRenderer.js │ │ │ ├── ReactDOMServerBrowser.js │ │ │ ├── ReactDOMServerNode.js │ │ │ ├── ReactDOMStringRenderer.js │ │ │ ├── ReactPartialRenderer.js │ │ │ ├── ReactPartialRendererContext.js │ │ │ ├── ReactPartialRendererHooks.js │ │ │ ├── ReactThreadIDAllocator.js │ │ │ ├── escapeTextForBrowser.js │ │ │ └── quoteAttributeValueForBrowser.js │ │ ├── shared │ │ │ ├── CSSProperty.js │ │ │ ├── CSSPropertyOperations.js │ │ │ ├── CSSShorthandProperty.js │ │ │ ├── DOMNamespaces.js │ │ │ ├── DOMProperty.js │ │ │ ├── HTMLNodeType.js │ │ │ ├── ReactControlledValuePropTypes.js │ │ │ ├── ReactDOMInvalidARIAHook.js │ │ │ ├── ReactDOMNullInputValuePropHook.js │ │ │ ├── ReactDOMUnknownPropertyHook.js │ │ │ ├── assertValidProps.js │ │ │ ├── checkReact.js │ │ │ ├── createMicrosoftUnsafeLocalFunction.js │ │ │ ├── dangerousStyleValue.js │ │ │ ├── hyphenateStyleName.js │ │ │ ├── isCustomComponent.js │ │ │ ├── omittedCloseTags.js │ │ │ ├── possibleStandardNames.js │ │ │ ├── sanitizeURL.js │ │ │ ├── validAriaProperties.js │ │ │ ├── voidElementTags.js │ │ │ └── warnValidStyle.js │ │ ├── test-utils │ │ │ ├── ReactTestUtils.js │ │ │ └── ReactTestUtilsAct.js │ │ └── unstable-native-dependencies │ │ │ └── ReactDOMUnstableNativeDependencies.js │ ├── test-utils.js │ ├── unstable-fire.js │ ├── unstable-fizz.browser.js │ ├── unstable-fizz.js │ ├── unstable-fizz.node.js │ ├── unstable-native-dependencies.js │ ├── unstable-new-scheduler.fb.js │ └── unstable-new-scheduler.js ├── react-events │ ├── README.md │ ├── drag.js │ ├── focus.js │ ├── hover.js │ ├── index.js │ ├── npm │ │ ├── drag.js │ │ ├── focus.js │ │ ├── hover.js │ │ ├── index.js │ │ ├── press.js │ │ └── swipe.js │ ├── package.json │ ├── press.js │ ├── src │ │ ├── Drag.js │ │ ├── Focus.js │ │ ├── Hover.js │ │ ├── Press.js │ │ ├── ReactEvents.js │ │ ├── Swipe.js │ │ └── __tests__ │ │ │ ├── Drag-test.internal.js │ │ │ ├── Focus-test.internal.js │ │ │ ├── Hover-test.internal.js │ │ │ ├── Press-test.internal.js │ │ │ └── TouchHitTarget-test.internal.js │ └── swipe.js ├── react-is │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ReactIs.js │ │ └── __tests__ │ │ └── ReactIs-test.js ├── react-native-renderer │ ├── fabric.js │ ├── index.js │ ├── package.json │ └── src │ │ ├── NativeMethodsMixin.js │ │ ├── NativeMethodsMixinUtils.js │ │ ├── ReactFabric.js │ │ ├── ReactFabricComponentTree.js │ │ ├── ReactFabricEventEmitter.js │ │ ├── ReactFabricGlobalResponderHandler.js │ │ ├── ReactFabricHostConfig.js │ │ ├── ReactFabricInjection.js │ │ ├── ReactNativeAttributePayload.js │ │ ├── ReactNativeBridgeEventPlugin.js │ │ ├── ReactNativeComponent.js │ │ ├── ReactNativeComponentTree.js │ │ ├── ReactNativeEventEmitter.js │ │ ├── ReactNativeEventPluginOrder.js │ │ ├── ReactNativeFiberHostComponent.js │ │ ├── ReactNativeFiberInspector.js │ │ ├── ReactNativeGlobalResponderHandler.js │ │ ├── ReactNativeHostConfig.js │ │ ├── ReactNativeInjection.js │ │ ├── ReactNativeInjectionShared.js │ │ ├── ReactNativeRenderer.js │ │ ├── ReactNativeRendererSharedExports.js │ │ ├── ReactNativeTypes.js │ │ ├── __mocks__ │ │ ├── BatchedBridge.js │ │ ├── ExceptionsManager.js │ │ ├── FabricUIManager.js │ │ ├── InitializeCore.js │ │ ├── Platform.js │ │ ├── RCTEventEmitter.js │ │ ├── ReactNativeViewConfigRegistry.js │ │ ├── TextInputState.js │ │ ├── UIManager.js │ │ ├── deepDiffer.js │ │ ├── deepFreezeAndThrowOnMutationInDev.js │ │ └── flattenStyle.js │ │ └── __tests__ │ │ ├── ReactFabric-test.internal.js │ │ ├── ReactFabricAndNative-test.internal.js │ │ ├── ReactNativeAttributePayload-test.js │ │ ├── ReactNativeError-test.internal.js │ │ ├── ReactNativeEvents-test.internal.js │ │ ├── ReactNativeMount-test.internal.js │ │ ├── __snapshots__ │ │ ├── ReactFabric-test.internal.js.snap │ │ ├── ReactNativeEvents-test.internal.js.snap │ │ └── ReactNativeMount-test.internal.js.snap │ │ └── createReactNativeComponentClass-test.internal.js ├── react-noop-renderer │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ ├── persistent.js │ │ └── server.js │ ├── package.json │ ├── persistent.js │ ├── server.js │ └── src │ │ ├── ReactNoop.js │ │ ├── ReactNoopPersistent.js │ │ ├── ReactNoopServer.js │ │ └── createReactNoop.js ├── react-reconciler │ ├── README.md │ ├── index.js │ ├── inline-typed.js │ ├── inline.art.js │ ├── inline.dom-browser.js │ ├── inline.dom.js │ ├── inline.fabric.js │ ├── inline.fire.js │ ├── inline.native.js │ ├── inline.test.js │ ├── npm │ │ ├── index.js │ │ ├── persistent.js │ │ └── reflection.js │ ├── package.json │ ├── persistent.js │ ├── reflection.js │ └── src │ │ ├── ReactCapturedValue.js │ │ ├── ReactChildFiber.js │ │ ├── ReactCurrentFiber.js │ │ ├── ReactDebugFiberPerf.js │ │ ├── ReactFiber.js │ │ ├── ReactFiberBeginWork.js │ │ ├── ReactFiberClassComponent.js │ │ ├── ReactFiberCommitWork.js │ │ ├── ReactFiberCompleteWork.js │ │ ├── ReactFiberContext.js │ │ ├── ReactFiberDevToolsHook.js │ │ ├── ReactFiberErrorDialog.js │ │ ├── ReactFiberErrorLogger.js │ │ ├── ReactFiberExpirationTime.js │ │ ├── ReactFiberHooks.js │ │ ├── ReactFiberHostConfig.js │ │ ├── ReactFiberHostContext.js │ │ ├── ReactFiberHydrationContext.js │ │ ├── ReactFiberInstrumentation.js │ │ ├── ReactFiberLazyComponent.js │ │ ├── ReactFiberNewContext.js │ │ ├── ReactFiberPendingPriority.js │ │ ├── ReactFiberReconciler.js │ │ ├── ReactFiberRoot.js │ │ ├── ReactFiberScheduler.js │ │ ├── ReactFiberScheduler.new.js │ │ ├── ReactFiberScheduler.old.js │ │ ├── ReactFiberStack.js │ │ ├── ReactFiberSuspenseComponent.js │ │ ├── ReactFiberTreeReflection.js │ │ ├── ReactFiberUnwindWork.js │ │ ├── ReactHookEffectTags.js │ │ ├── ReactProfilerTimer.js │ │ ├── ReactStrictModeWarnings.js │ │ ├── ReactTypeOfMode.js │ │ ├── ReactUpdateQueue.js │ │ ├── SchedulerWithReactIntegration.js │ │ ├── __tests__ │ │ ├── ErrorBoundaryReconciliation-test.internal.js │ │ ├── ReactExpiration-test.internal.js │ │ ├── ReactFiberEvents-test-internal.js │ │ ├── ReactFiberHostContext-test.js │ │ ├── ReactFragment-test.js │ │ ├── ReactHooks-test.internal.js │ │ ├── ReactHooksWithNoopRenderer-test.internal.js │ │ ├── ReactIncremental-test.internal.js │ │ ├── ReactIncrementalErrorHandling-test.internal.js │ │ ├── ReactIncrementalErrorLogging-test.js │ │ ├── ReactIncrementalErrorReplay-test.internal.js │ │ ├── ReactIncrementalErrorReplay-test.js │ │ ├── ReactIncrementalPerf-test.internal.js │ │ ├── ReactIncrementalReflection-test.internal.js │ │ ├── ReactIncrementalScheduling-test.internal.js │ │ ├── ReactIncrementalSideEffects-test.internal.js │ │ ├── ReactIncrementalTriangle-test.internal.js │ │ ├── ReactIncrementalUpdates-test.internal.js │ │ ├── ReactIncrementalUpdatesMinimalism-test.js │ │ ├── ReactLazy-test.internal.js │ │ ├── ReactMemo-test.internal.js │ │ ├── ReactNewContext-test.internal.js │ │ ├── ReactNoopRendererAct-test.js │ │ ├── ReactPersistent-test.js │ │ ├── ReactPersistentUpdatesMinimalism-test.js │ │ ├── ReactSchedulerIntegration-test.internal.js │ │ ├── ReactSuspense-test.internal.js │ │ ├── ReactSuspenseFuzz-test.internal.js │ │ ├── ReactSuspensePlaceholder-test.internal.js │ │ ├── ReactSuspenseWithNoopRenderer-test.internal.js │ │ ├── ReactTopLevelFragment-test.js │ │ ├── ReactTopLevelText-test.js │ │ ├── ReactTracing-test.internal.js │ │ └── __snapshots__ │ │ │ ├── ReactHooks-test.internal.js.snap │ │ │ └── ReactIncrementalPerf-test.internal.js.snap │ │ ├── forks │ │ ├── ReactFiberErrorDialog.native.js │ │ ├── ReactFiberErrorDialog.www.js │ │ ├── ReactFiberHostConfig.art.js │ │ ├── ReactFiberHostConfig.custom.js │ │ ├── ReactFiberHostConfig.dom-browser.js │ │ ├── ReactFiberHostConfig.dom.js │ │ ├── ReactFiberHostConfig.fabric.js │ │ ├── ReactFiberHostConfig.fire.js │ │ ├── ReactFiberHostConfig.native.js │ │ └── ReactFiberHostConfig.test.js │ │ └── maxSigned31BitInt.js ├── react-stream │ ├── README.md │ ├── index.js │ ├── inline-typed.js │ ├── inline.dom-browser.js │ ├── inline.dom.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ReactFizzFormatConfig.js │ │ ├── ReactFizzHostConfig.js │ │ ├── ReactFizzHostConfigBrowser.js │ │ ├── ReactFizzHostConfigNode.js │ │ ├── ReactFizzStreamer.js │ │ ├── __tests__ │ │ └── ReactServer-test.js │ │ └── forks │ │ ├── ReactFizzFormatConfig.custom.js │ │ ├── ReactFizzFormatConfig.dom-browser.js │ │ ├── ReactFizzFormatConfig.dom.js │ │ ├── ReactFizzHostConfig.custom.js │ │ ├── ReactFizzHostConfig.dom-browser.js │ │ └── ReactFizzHostConfig.dom.js ├── react-test-renderer │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ └── shallow.js │ ├── package.json │ ├── shallow.js │ └── src │ │ ├── ReactShallowRenderer.js │ │ ├── ReactTestHostConfig.js │ │ ├── ReactTestRenderer.js │ │ ├── ReactTestRendererAct.js │ │ └── __tests__ │ │ ├── ReactShallowRenderer-test.js │ │ ├── ReactShallowRendererHooks-test.js │ │ ├── ReactShallowRendererMemo-test.js │ │ ├── ReactTestRenderer-test.internal.js │ │ ├── ReactTestRenderer-test.js │ │ ├── ReactTestRendererAct-test.js │ │ ├── ReactTestRendererAsync-test.js │ │ └── ReactTestRendererTraversal-test.js ├── react │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── React.js │ │ ├── ReactBaseClasses.js │ │ ├── ReactChildren.js │ │ ├── ReactContext.js │ │ ├── ReactCreateRef.js │ │ ├── ReactCurrentDispatcher.js │ │ ├── ReactCurrentOwner.js │ │ ├── ReactDebugCurrentFrame.js │ │ ├── ReactElement.js │ │ ├── ReactElementValidator.js │ │ ├── ReactHooks.js │ │ ├── ReactLazy.js │ │ ├── ReactNoopUpdateQueue.js │ │ ├── ReactSharedInternals.js │ │ ├── __tests__ │ │ ├── ReactChildren-test.js │ │ ├── ReactClassEquivalence-test.js │ │ ├── ReactCoffeeScriptClass-test.coffee │ │ ├── ReactContextValidator-test.js │ │ ├── ReactCreateRef-test.js │ │ ├── ReactES6Class-test.js │ │ ├── ReactElement-test.js │ │ ├── ReactElementClone-test.js │ │ ├── ReactElementValidator-test.internal.js │ │ ├── ReactJSXElement-test.js │ │ ├── ReactJSXElementValidator-test.js │ │ ├── ReactProfiler-test.internal.js │ │ ├── ReactProfilerDOM-test.internal.js │ │ ├── ReactProfilerDevToolsIntegration-test.internal.js │ │ ├── ReactPureComponent-test.js │ │ ├── ReactStrictMode-test.internal.js │ │ ├── ReactStrictMode-test.js │ │ ├── ReactTypeScriptClass-test.ts │ │ ├── __snapshots__ │ │ │ └── ReactProfiler-test.internal.js.snap │ │ ├── createReactClassIntegration-test.internal.js │ │ ├── createReactClassIntegration-test.js │ │ ├── forwardRef-test.internal.js │ │ ├── forwardRef-test.js │ │ ├── onlyChild-test.js │ │ ├── testDefinitions │ │ │ ├── PropTypes.d.ts │ │ │ ├── React.d.ts │ │ │ └── ReactDOM.d.ts │ │ └── withComponentStack-test.js │ │ ├── forks │ │ ├── ReactCurrentDispatcher.www.js │ │ └── ReactCurrentOwner.www.js │ │ ├── forwardRef.js │ │ ├── memo.js │ │ └── withComponentStack.js ├── scheduler │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ ├── tracing-profiling.js │ │ ├── tracing.js │ │ ├── umd │ │ │ ├── scheduler-tracing.development.js │ │ │ ├── scheduler-tracing.production.min.js │ │ │ ├── scheduler-tracing.profiling.min.js │ │ │ ├── scheduler.development.js │ │ │ ├── scheduler.production.min.js │ │ │ └── scheduler.profiling.min.js │ │ └── unstable_mock.js │ ├── package.json │ ├── src │ │ ├── Scheduler.js │ │ ├── SchedulerFeatureFlags.js │ │ ├── SchedulerHostConfig.js │ │ ├── Tracing.js │ │ ├── TracingSubscriptions.js │ │ ├── __tests__ │ │ │ ├── Scheduler-test.js │ │ │ ├── SchedulerDOM-test.js │ │ │ ├── SchedulerNoDOM-test.js │ │ │ ├── SchedulerUMDBundle-test.internal.js │ │ │ ├── Tracing-test.internal.js │ │ │ ├── Tracing-test.js │ │ │ └── TracingSubscriptions-test.internal.js │ │ └── forks │ │ │ ├── SchedulerFeatureFlags.www.js │ │ │ ├── SchedulerHostConfig.default.js │ │ │ └── SchedulerHostConfig.mock.js │ ├── tracing.js │ └── unstable_mock.js └── shared │ ├── ExecutionEnvironment.js │ ├── HostConfigWithNoHydration.js │ ├── HostConfigWithNoMutation.js │ ├── HostConfigWithNoPersistence.js │ ├── ReactElementType.js │ ├── ReactError.js │ ├── ReactErrorProd.js │ ├── ReactErrorUtils.js │ ├── ReactFeatureFlags.js │ ├── ReactInstanceMap.js │ ├── ReactLazyComponent.js │ ├── ReactPortal.js │ ├── ReactSharedInternals.js │ ├── ReactSideEffectTags.js │ ├── ReactSymbols.js │ ├── ReactTreeTraversal.js │ ├── ReactTypes.js │ ├── ReactVersion.js │ ├── ReactWorkTags.js │ ├── __tests__ │ ├── ReactDOMFrameScheduling-test.js │ ├── ReactError-test.internal.js │ ├── ReactErrorProd-test.internal.js │ ├── ReactErrorUtils-test.internal.js │ ├── ReactSymbols-test.internal.js │ └── describeComponentFrame-test.js │ ├── describeComponentFrame.js │ ├── enqueueTask.js │ ├── forks │ ├── ReactFeatureFlags.native-fb.js │ ├── ReactFeatureFlags.native-oss.js │ ├── ReactFeatureFlags.new-scheduler.js │ ├── ReactFeatureFlags.persistent.js │ ├── ReactFeatureFlags.readonly.js │ ├── ReactFeatureFlags.test-renderer.js │ ├── ReactFeatureFlags.test-renderer.www.js │ ├── ReactFeatureFlags.www-new-scheduler.js │ ├── ReactFeatureFlags.www.js │ ├── Scheduler.umd.js │ ├── SchedulerTracing.umd.js │ ├── invokeGuardedCallbackImpl.www.js │ ├── lowPriorityWarning.www.js │ ├── object-assign.umd.js │ └── warningWithoutStack.www.js │ ├── getComponentName.js │ ├── invariant.js │ ├── invokeGuardedCallbackImpl.js │ ├── isTextInputElement.js │ ├── isValidElementType.js │ ├── lowPriorityWarning.js │ ├── objectIs.js │ ├── package.json │ ├── shallowEqual.js │ ├── warning.js │ └── warningWithoutStack.js ├── scripts ├── authors ├── babel │ ├── __tests__ │ │ ├── transform-prevent-infinite-loops-test.js │ │ └── wrap-warning-with-env-check-test.js │ ├── transform-object-assign-require.js │ ├── transform-prevent-infinite-loops.js │ └── wrap-warning-with-env-check.js ├── bench │ ├── .gitignore │ ├── README.md │ ├── benchmark.js │ ├── benchmarks │ │ ├── hacker-news │ │ │ ├── benchmark.js │ │ │ ├── build.js │ │ │ ├── generate.js │ │ │ ├── grayarrow.gif │ │ │ ├── index.html │ │ │ ├── logo.png │ │ │ ├── style.css │ │ │ └── top-stories.js │ │ ├── pe-class-components │ │ │ ├── benchmark.js │ │ │ ├── build.js │ │ │ └── index.html │ │ ├── pe-functional-components │ │ │ ├── benchmark.js │ │ │ ├── build.js │ │ │ └── index.html │ │ └── pe-no-components │ │ │ ├── benchmark.js │ │ │ ├── build.js │ │ │ └── index.html │ ├── build.js │ ├── package.json │ ├── runner.js │ ├── server.js │ ├── stats.js │ └── yarn.lock ├── circleci │ ├── add_build_info_json.sh │ ├── bench.sh │ ├── build.sh │ ├── check_license.sh │ ├── check_modules.sh │ ├── pack_and_store_artifact.sh │ ├── set_up_github_keys.sh │ ├── test_coverage.sh │ ├── test_entry_point.sh │ ├── test_print_warnings.sh │ ├── update_package_versions.sh │ └── upload_build.sh ├── error-codes │ ├── README.md │ ├── Types.js │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── minify-error-messages.js.snap │ │ ├── invertObject-test.js │ │ └── minify-error-messages.js │ ├── codes.json │ ├── extract-errors.js │ ├── invertObject.js │ └── minify-error-messages.js ├── eslint-rules │ ├── README.md │ ├── __tests__ │ │ ├── no-primitive-constructors-test.internal.js │ │ ├── no-to-warn-dev-within-to-throw-test.internal.js │ │ └── warning-and-invariant-args-test.internal.js │ ├── index.js │ ├── no-primitive-constructors.js │ ├── no-to-warn-dev-within-to-throw.js │ ├── package.json │ └── warning-and-invariant-args.js ├── eslint │ └── index.js ├── flow │ ├── config │ │ └── flowconfig │ ├── createFlowConfigs.js │ ├── environment.js │ ├── react-native-host-hooks.js │ └── runFlow.js ├── git │ └── pre-commit ├── jest │ ├── config.base.js │ ├── config.build.js │ ├── config.source-fire.js │ ├── config.source-new-scheduler.js │ ├── config.source-persistent.js │ ├── config.source.js │ ├── dont-run-jest-directly.js │ ├── matchers │ │ ├── __tests__ │ │ │ └── toWarnDev-test.js │ │ ├── interactionTracing.js │ │ ├── reactTestMatchers.js │ │ ├── schedulerTestMatchers.js │ │ └── toWarnDev.js │ ├── noHaste.js │ ├── preprocessor.js │ ├── setupEnvironment.js │ ├── setupFire.js │ ├── setupHostConfigs.js │ ├── setupNewScheduler.js │ ├── setupTests.build.js │ ├── setupTests.js │ ├── setupTests.persistent.js │ ├── shouldIgnoreConsoleError.js │ ├── spec-equivalence-reporter │ │ └── setupTests.js │ └── typescript │ │ ├── jest.d.ts │ │ └── preprocessor.js ├── perf-counters │ ├── Makefile │ ├── README.md │ ├── binding.gyp │ ├── index.js │ ├── package.json │ └── src │ │ ├── hardware-counter.cpp │ │ ├── hardware-counter.h │ │ ├── jsc-perf.cpp │ │ ├── perf-counters.cpp │ │ ├── portability.h │ │ ├── thread-local.cpp │ │ └── thread-local.h ├── prettier │ └── index.js ├── print-warnings │ ├── README.md │ └── print-warnings.js ├── release │ ├── .gitignore │ ├── README.md │ ├── ci-add-build-info-json.js │ ├── ci-update-package-versions.js │ ├── create-canary-commands │ │ ├── add-build-info-json.js │ │ ├── build-artifacts.js │ │ ├── confirm-automated-testing.js │ │ ├── copy-repo-to-temp-directory.js │ │ ├── npm-pack-and-unpack.js │ │ └── update-version-numbers.js │ ├── create-canary.js │ ├── package.json │ ├── prepare-canary-commands │ │ ├── check-environment-variables.js │ │ ├── download-build-artifacts.js │ │ ├── get-latest-master-build-number.js │ │ └── parse-params.js │ ├── prepare-canary.js │ ├── prepare-stable-commands │ │ ├── check-out-packages.js │ │ ├── confirm-stable-version-numbers.js │ │ ├── get-latest-canary-version.js │ │ ├── guess-stable-version-numbers.js │ │ ├── parse-params.js │ │ └── update-stable-version-numbers.js │ ├── prepare-stable.js │ ├── publish-commands │ │ ├── check-npm-permissions.js │ │ ├── confirm-version-and-tags.js │ │ ├── download-error-codes-from-ci.js │ │ ├── parse-params.js │ │ ├── print-follow-up-instructions.js │ │ ├── prompt-for-otp.js │ │ ├── publish-to-npm.js │ │ ├── update-stable-version-numbers.js │ │ └── validate-tags.js │ ├── publish.js │ ├── shared-commands │ │ ├── print-prerelease-summary.js │ │ ├── test-packaging-fixture.js │ │ └── test-tracing-fixture.js │ ├── snapshot-test.js │ ├── snapshot-test.snapshot │ ├── theme.js │ ├── utils.js │ └── yarn.lock ├── rollup │ ├── build.js │ ├── bundles.js │ ├── forks.js │ ├── modules.js │ ├── packaging.js │ ├── plugins │ │ ├── closure-plugin.js │ │ ├── sizes-plugin.js │ │ ├── strip-unused-imports.js │ │ └── use-forks-plugin.js │ ├── results.json │ ├── shims │ │ ├── facebook-www │ │ │ ├── ReactBrowserEventEmitter_DO_NOT_USE.js │ │ │ ├── ReactDOMComponentTree_DO_NOT_USE.js │ │ │ ├── ReactInstanceMap_DO_NOT_USE.js │ │ │ ├── findDOMNode.js │ │ │ └── renderSubtreeIntoContainer_DO_NOT_USE.js │ │ ├── react-native-fb │ │ │ └── ReactFeatureFlags.js │ │ └── react-native │ │ │ ├── NativeMethodsMixin.js │ │ │ ├── ReactFabric.js │ │ │ ├── ReactNative.js │ │ │ ├── ReactNativeViewConfigRegistry.js │ │ │ └── createReactNativeComponentClass.js │ ├── stats.js │ ├── sync.js │ ├── utils.js │ ├── validate │ │ ├── eslintignore │ │ ├── eslintrc.cjs.js │ │ ├── eslintrc.fb.js │ │ ├── eslintrc.rn.js │ │ ├── eslintrc.umd.js │ │ └── index.js │ └── wrappers.js ├── shared │ ├── __tests__ │ │ └── evalToString-test.js │ ├── evalToString.js │ ├── inlinedHostConfigs.js │ ├── listChangedFiles.js │ └── pathsByLanguageVersion.js └── tasks │ ├── danger.js │ ├── eslint.js │ ├── flow-ci.js │ ├── flow.js │ ├── linc.js │ └── version-check.js ├── src ├── index.js ├── react-dom │ ├── diff-两颗虚拟树.js │ ├── diff.js │ ├── keyDiff.js │ ├── patch-差异更新到真实树.js │ └── render.js └── react │ ├── component.js │ ├── createElement.js │ ├── enqueueSetState.js │ └── index.js └── 学习笔记 ├── React-bable编译Jsx.md ├── React-组件元素实例与Jsx语法.md ├── React15diff算法模拟实现.md ├── React15diff算法策略.md ├── React15实现思路.md ├── React1610之后切换为最小堆#16245.md ├── React16源码解析1-了解Fiber.md ├── React16源码解析2-渲染帧与requestIdleCallback.md ├── React16源码解析3-Scheduler任务调度器.md ├── React16源码解析4-Render流程.md ├── React16源码解析5-setState同步异步本质.md ├── React16源码解析6-Fiber链式diff算法.md ├── React16源码解析commit流程-待看.md ├── React16源码解析hooks原理-待看.md ├── React18改动.md ├── img ├── Child避免从末尾插入头部.png ├── FiberReconciler的执行阶段的生命周期调用.png ├── FiberTree.png ├── Fiber与浏览器任务切换.png ├── KeyDiff1.png ├── KeyDiffDelOne.png ├── React15diffKey.png ├── React15diffVdomVdom.png ├── React15diff删除节点.png ├── React15diff同层比较策略.png ├── React15diff策略.png ├── React16源码阅读总结流程图.svg ├── React双向缓存首屏.png ├── React双向缓存首屏渲染完成.png ├── React双缓存完成更新.png ├── React双缓存技术.png ├── React调度流程图.png ├── VTree与FiberTree.jpg ├── createUpdate.png ├── ensureRootIsScheduled.png ├── newChild单个但是ordChild多个.png ├── reactRootContainer.png ├── render流程.png ├── scheduleWork.png ├── 任务划分.png ├── 分片.png ├── 完整流程图.png ├── 帧任务.png ├── 帧任务2.png ├── 并发渲染.png ├── 执行帧.png ├── 生命周期中的setState.png ├── 调度.png └── 链式遍历.png └── 任务调度-草稿.md /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"], 3 | "plugins": [ 4 | ["transform-react-jsx", { 5 | "pragma": "React.createElement" 6 | }] 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | .DS_Store 3 | node_modules/ 4 | dist/ 5 | npm-debug.log 6 | yarn-error.log 7 | 8 | # Editor directories and files 9 | .idea 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | .vscode 15 | .history 16 | -------------------------------------------------------------------------------- /fixtures/art/.gitignore: -------------------------------------------------------------------------------- 1 | bundle.js -------------------------------------------------------------------------------- /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/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/art/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VectorWidget 5 | 6 | 7 | 8 |
9 |

If you're seeing this message, it means you haven't generated the bundle file for this example. Try running:

10 | 11 |

12 |     npm install
13 |     npm run build
14 |     
15 | 16 |

then reload the page.

17 |
18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /fixtures/art/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "babel-core": "^6.24.0", 4 | "babel-loader": "^6.4.1", 5 | "babel-plugin-transform-class-properties": "^6.24.1", 6 | "babel-preset-es2015": "^6.6.0", 7 | "babel-preset-react": "^6.5.0", 8 | "react": "link:../../build/node_modules/react", 9 | "react-art": "link:../../build/node_modules/react-art/", 10 | "react-dom": "link:../../build/node_modules/react-dom", 11 | "webpack": "^1.14.0" 12 | }, 13 | "scripts": { 14 | "build": "webpack app.js bundle.js" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /fixtures/attribute-behavior/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://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 | /public/react.development.js 12 | /public/react-dom.development.js 13 | /public/react-dom-server.browser.development.js 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /fixtures/attribute-behavior/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "attribute-behavior", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "file-saver": "^1.3.3", 7 | "glamor": "^2.20.40", 8 | "react": "^15.6.1", 9 | "react-dom": "^15.6.1", 10 | "react-scripts": "1.0.11", 11 | "react-virtualized": "^9.9.0" 12 | }, 13 | "scripts": { 14 | "prestart": 15 | "cp ../../build/node_modules/react/umd/react.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom-server.browser.development.js public/", 16 | "start": "react-scripts start", 17 | "build": "react-scripts build", 18 | "test": "react-scripts test --env=jsdom", 19 | "eject": "react-scripts eject" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /fixtures/attribute-behavior/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/attribute-behavior/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/attribute-behavior/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /fixtures/dom/.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 | public/react.development.js 12 | public/react.production.min.js 13 | public/react-dom.development.js 14 | public/react-dom.production.min.js 15 | public/react-dom-server.browser.development.js 16 | public/react-dom-server.browser.production.min.js 17 | public/react-dom-test-utils.development.js 18 | public/react-dom-test-utils.production.min.js 19 | 20 | # misc 21 | .DS_Store 22 | .env 23 | npm-debug.log 24 | -------------------------------------------------------------------------------- /fixtures/dom/README.md: -------------------------------------------------------------------------------- 1 | # DOM Fixtures 2 | 3 | A set of DOM test cases for quickly identifying browser issues. 4 | 5 | ## Setup 6 | 7 | To reference a local build of React, first run `yarn build` at the root 8 | of the React project. Then: 9 | 10 | ``` 11 | cd fixtures/dom 12 | yarn 13 | yarn start 14 | ``` 15 | 16 | The `start` command runs a script that copies over the local build of react into 17 | the public directory. 18 | -------------------------------------------------------------------------------- /fixtures/dom/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/dom/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/dom/public/test.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/dom/public/test.mp4 -------------------------------------------------------------------------------- /fixtures/dom/src/components/App.js: -------------------------------------------------------------------------------- 1 | import Header from './Header'; 2 | import Fixtures from './fixtures'; 3 | import '../style.css'; 4 | 5 | const React = window.React; 6 | 7 | class App extends React.Component { 8 | render() { 9 | return ( 10 |
11 |
12 | 13 |
14 | ); 15 | } 16 | } 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/Fixture.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | const React = window.React; 3 | 4 | const propTypes = { 5 | children: PropTypes.node.isRequired, 6 | }; 7 | 8 | class Fixture extends React.Component { 9 | render() { 10 | const {children} = this.props; 11 | 12 | return
{children}
; 13 | } 14 | } 15 | 16 | Fixture.propTypes = propTypes; 17 | 18 | export default Fixture; 19 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/FixtureSet.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | const React = window.React; 3 | 4 | const propTypes = { 5 | title: PropTypes.node.isRequired, 6 | description: PropTypes.node, 7 | }; 8 | 9 | class FixtureSet extends React.Component { 10 | render() { 11 | const {title, description, children} = this.props; 12 | 13 | return ( 14 |
15 |

{title}

16 | {description &&

{description}

} 17 | 18 | {children} 19 |
20 | ); 21 | } 22 | } 23 | 24 | FixtureSet.propTypes = propTypes; 25 | 26 | export default FixtureSet; 27 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/IssueList.js: -------------------------------------------------------------------------------- 1 | const React = window.React; 2 | 3 | function csv(string) { 4 | return string.split(/\s*,\s*/); 5 | } 6 | 7 | export default function IssueList({issues}) { 8 | if (!issues) { 9 | return null; 10 | } 11 | 12 | if (typeof issues === 'string') { 13 | issues = csv(issues); 14 | } 15 | 16 | let links = issues.reduce((memo, issue, i) => { 17 | return memo.concat( 18 | i > 0 && i < issues.length ? ', ' : null, 19 | 20 | {issue} 21 | 22 | ); 23 | }, []); 24 | 25 | return {links}; 26 | } 27 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/event-pooling/index.js: -------------------------------------------------------------------------------- 1 | import FixtureSet from '../../FixtureSet'; 2 | import MouseMove from './mouse-move'; 3 | import Persistence from './persistence'; 4 | 5 | const React = window.React; 6 | 7 | class EventPooling extends React.Component { 8 | render() { 9 | return ( 10 | 11 | 12 | 13 | 14 | ); 15 | } 16 | } 17 | 18 | export default EventPooling; 19 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/hydration/code-transformer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Babel works across all browsers, however it requires many polyfills. 3 | */ 4 | 5 | import 'core-js/es6/weak-map'; 6 | import 'core-js/es6/weak-set'; 7 | import 'core-js/es6/number'; 8 | import 'core-js/es6/string'; 9 | import 'core-js/es6/array'; 10 | import 'core-js/modules/es6.object.set-prototype-of'; 11 | 12 | import {transform} from '@babel/standalone'; 13 | 14 | const presets = ['es2015', 'stage-3', 'react']; 15 | 16 | export function compile(raw) { 17 | return transform(raw, {presets}).code; 18 | } 19 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/hydration/data.js: -------------------------------------------------------------------------------- 1 | export const SAMPLE_CODE = ` 2 | class Fixture extends React.Component { 3 | state = { 4 | value: 'asdf' 5 | } 6 | 7 | onChange(event) { 8 | this.setState({ value: event.target.value }); 9 | } 10 | 11 | render() { 12 | const { value } = this.state; 13 | 14 | return ( 15 |
16 | 17 |

Value: {value}

18 |
19 | ); 20 | } 21 | } 22 | `.trim(); 23 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/mouse-events/index.js: -------------------------------------------------------------------------------- 1 | import FixtureSet from '../../FixtureSet'; 2 | import MouseMovement from './mouse-movement'; 3 | 4 | const React = window.React; 5 | 6 | class MouseEvents extends React.Component { 7 | render() { 8 | return ( 9 | 10 | 11 | 12 | ); 13 | } 14 | } 15 | 16 | export default MouseEvents; 17 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/pointer-events/drag.js: -------------------------------------------------------------------------------- 1 | import TestCase from '../../TestCase'; 2 | import DragBox from './drag-box'; 3 | 4 | const React = window.React; 5 | 6 | class Drag extends React.Component { 7 | render() { 8 | return ( 9 | 10 | 11 |
  • Drag the circle below with any pointer tool
  • 12 |
    13 | 14 | 15 | While dragging, the circle must have turn blue to indicate that a 16 | pointer capture was received. 17 | 18 | 19 | 20 |
    21 | ); 22 | } 23 | } 24 | 25 | export default Drag; 26 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/pointer-events/index.js: -------------------------------------------------------------------------------- 1 | import FixtureSet from '../../FixtureSet'; 2 | import Drag from './drag'; 3 | import Hover from './hover'; 4 | 5 | const React = window.React; 6 | 7 | class PointerEvents extends React.Component { 8 | render() { 9 | return ( 10 | 13 | 14 | 15 | 16 | ); 17 | } 18 | } 19 | 20 | export default PointerEvents; 21 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/fixtures/selection-events/index.js: -------------------------------------------------------------------------------- 1 | import FixtureSet from '../../FixtureSet'; 2 | import ReorderedInputsTestCase from './ReorderedInputsTestCase'; 3 | import OnSelectEventTestCase from './OnSelectEventTestCase'; 4 | const React = window.React; 5 | 6 | export default function SelectionEvents() { 7 | return ( 8 | 15 | 16 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /fixtures/dom/src/components/propTypes.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types'; 2 | import semver from 'semver'; 3 | 4 | export function semverString(props, propName, componentName) { 5 | let version = props[propName]; 6 | 7 | let error = PropTypes.string(...arguments); 8 | if (!error && version != null && !semver.valid(version)) 9 | error = new Error( 10 | `\`${propName}\` should be a valid "semantic version" matching ` + 11 | 'an existing React version' 12 | ); 13 | 14 | return error || null; 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/dom/src/find-dom-node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides a standard way to access a DOM node across all versions of 3 | * React. 4 | */ 5 | 6 | import {reactPaths} from './react-loader'; 7 | 8 | const React = window.React; 9 | const ReactDOM = window.ReactDOM; 10 | 11 | export function findDOMNode(target) { 12 | const {needsReactDOM} = reactPaths(); 13 | 14 | if (needsReactDOM) { 15 | return ReactDOM.findDOMNode(target); 16 | } else { 17 | // eslint-disable-next-line 18 | return React.findDOMNode(target); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /fixtures/dom/src/index.js: -------------------------------------------------------------------------------- 1 | import './polyfills'; 2 | import loadReact from './react-loader'; 3 | 4 | loadReact() 5 | .then(() => import('./components/App')) 6 | .then(App => { 7 | const {React, ReactDOM} = window; 8 | 9 | ReactDOM.render( 10 | React.createElement(App.default), 11 | document.getElementById('root') 12 | ); 13 | }); 14 | -------------------------------------------------------------------------------- /fixtures/eslint/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parserOptions": { 4 | "ecmaVersion": 8, 5 | "sourceType": "module", 6 | "ecmaFeatures": { 7 | "jsx": true 8 | } 9 | }, 10 | "plugins": ["react-hooks"], 11 | "rules": { 12 | "react-hooks/rules-of-hooks": 2, 13 | "react-hooks/exhaustive-deps": 2 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/eslint/README.md: -------------------------------------------------------------------------------- 1 | # ESLint Playground Fixture 2 | 3 | This is an internal playground for quick iteration on our lint rules inside an IDE like VSCode. 4 | 5 | See instructions in `./index.js` in this directory. 6 | 7 | ![Demo](https://duaw26jehqd4r.cloudfront.net/items/2Z390a31003O0l0o0e3O/Screen%20Recording%202019-01-16%20at%2010.29%20PM.gif?v=d6856125) -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/eslint/proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "version": "0.0.0" 4 | } -------------------------------------------------------------------------------- /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/expiration/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://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 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | public/react.development.js 24 | public/react-dom.development.js -------------------------------------------------------------------------------- /fixtures/expiration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "expiration-2", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.1.1", 7 | "react-dom": "^16.1.1", 8 | "react-scripts": "1.0.17" 9 | }, 10 | "scripts": { 11 | "prestart": 12 | "cp ../../build/node_modules/react/umd/react.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom.development.js public/", 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test --env=jsdom", 16 | "eject": "react-scripts eject" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fixtures/fiber-debugger/.env: -------------------------------------------------------------------------------- 1 | NODE_PATH=../../build/packages -------------------------------------------------------------------------------- /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/fiber-debugger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-fiber-debugger", 3 | "version": "0.0.1", 4 | "private": true, 5 | "devDependencies": { 6 | "react-scripts": "0.9.5" 7 | }, 8 | "dependencies": { 9 | "dagre": "^0.7.4", 10 | "pretty-format": "^4.2.1", 11 | "react-draggable": "^2.2.6", 12 | "react-motion": "^0.5.0" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fixtures/fiber-debugger/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/fiber-debugger/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/fiber-debugger/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | React App 9 | 10 | 11 |
    12 | 13 | 14 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /fixtures/packaging/babel-standalone/dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
    7 | 13 | 14 | -------------------------------------------------------------------------------- /fixtures/packaging/browserify/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js 2 | -------------------------------------------------------------------------------- /fixtures/packaging/browserify/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/browserify/dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "browserify-dev-fixture", 4 | "dependencies": { 5 | "browserify": "^13.3.0" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && browserify ./input.js -o output.js", 9 | "prebuild": "cp -r ../../../../build/node_modules/* ./node_modules/" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /fixtures/packaging/browserify/prod/.gitignore: -------------------------------------------------------------------------------- 1 | output.js 2 | -------------------------------------------------------------------------------- /fixtures/packaging/browserify/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/browserify/prod/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "browserify-prod-fixture", 4 | "dependencies": { 5 | "browserify": "^13.3.0" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && browserify ./input.js -g [envify --NODE_ENV 'production'] -o output.js", 9 | "prebuild": "cp -r ../../../../build/node_modules/* ./node_modules/" 10 | }, 11 | "devDependencies": { 12 | "envify": "^4.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /fixtures/packaging/brunch/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js 2 | output.js.map -------------------------------------------------------------------------------- /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/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/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /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/dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "brunch-dev-fixture", 4 | "devDependencies": { 5 | "brunch": "^2.9.1", 6 | "javascript-brunch": "^2.0.0" 7 | }, 8 | "scripts": { 9 | "build": "rm -rf public && brunch build", 10 | "prebuild": "cp -r ../../../../build/node_modules/* ./node_modules/" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /fixtures/packaging/brunch/prod/.gitignore: -------------------------------------------------------------------------------- 1 | output.js 2 | output.js.map -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/packaging/brunch/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /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/brunch/prod/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "brunch-prod-fixture", 4 | "devDependencies": { 5 | "brunch": "^2.9.1", 6 | "javascript-brunch": "^2.0.0" 7 | }, 8 | "scripts": { 9 | "build": "rm -rf public && brunch build -p", 10 | "prebuild": "cp -r ../../../../build/node_modules/* ./node_modules/" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /fixtures/packaging/globals/dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 | 12 | 13 | -------------------------------------------------------------------------------- /fixtures/packaging/globals/prod.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 | 12 | 13 | -------------------------------------------------------------------------------- /fixtures/packaging/requirejs/dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 20 | 21 | -------------------------------------------------------------------------------- /fixtures/packaging/requirejs/prod.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 20 | 21 | -------------------------------------------------------------------------------- /fixtures/packaging/rjs/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/rjs/dev/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | baseUrl: '.', 3 | name: 'input', 4 | out: 'output.js', 5 | optimize: 'none', 6 | paths: { 7 | react: '../../../../build/node_modules/react/umd/react.development', 8 | 'react-dom': 9 | '../../../../build/node_modules/react-dom/umd/react-dom.development', 10 | schedule: '../../../../build/dist/schedule.development', 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /fixtures/packaging/rjs/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /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/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/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/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/rjs/prod/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | baseUrl: '.', 3 | name: 'input', 4 | out: 'output.js', 5 | optimize: 'none', 6 | paths: { 7 | react: '../../../../build/node_modules/react/umd/react.production.min', 8 | 'react-dom': 9 | '../../../../build/node_modules/react-dom/umd/react-dom.production.min', 10 | schedule: '../../../../build/dist/schedule.development', 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /fixtures/packaging/rjs/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/dev/build.js: -------------------------------------------------------------------------------- 1 | var Builder = require('systemjs-builder'); 2 | 3 | var builder = new Builder('/', './config.js'); 4 | builder 5 | .buildStatic('./input.js', './output.js') 6 | .then(function() { 7 | console.log('Build complete'); 8 | }) 9 | .catch(function(err) { 10 | console.log('Build error'); 11 | console.log(err); 12 | }); 13 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/dev/config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | paths: { 3 | react: '../../../../build/node_modules/react/umd/react.development.js', 4 | 'react-dom': 5 | '../../../../build/node_modules/react-dom/umd/react-dom.development.js', 6 | schedule: '../../../../build/dist/schedule.development', 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/prod/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/prod/build.js: -------------------------------------------------------------------------------- 1 | var Builder = require('systemjs-builder'); 2 | 3 | var builder = new Builder('/', './config.js'); 4 | builder 5 | .buildStatic('./input.js', './output.js') 6 | .then(function() { 7 | console.log('Build complete'); 8 | }) 9 | .catch(function(err) { 10 | console.log('Build error'); 11 | console.log(err); 12 | }); 13 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/prod/config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | paths: { 3 | react: '../../../../build/node_modules/react/umd/react.production.min.js', 4 | 'react-dom': 5 | '../../../../build/node_modules/react-dom/umd/react-dom.production.min.js', 6 | schedule: '../../../../build/dist/schedule.development', 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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/systemjs/dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 26 | 27 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/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/node_modules'), 10 | alias: { 11 | react: 'react/umd/react.development', 12 | 'react-dom': 'react-dom/umd/react-dom.development', 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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-alias/prod/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/prod/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/node_modules'), 10 | alias: { 11 | react: 'react/umd/react.production.min', 12 | 'react-dom': 'react-dom/umd/react-dom.production.min', 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/dev/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /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/node_modules/'), 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/dev/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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/.gitignore: -------------------------------------------------------------------------------- 1 | output.js -------------------------------------------------------------------------------- /fixtures/packaging/webpack/prod/config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var webpack = require('webpack'); 3 | 4 | module.exports = { 5 | entry: './input', 6 | output: { 7 | filename: 'output.js', 8 | }, 9 | resolve: { 10 | root: path.resolve('../../../../build/node_modules/'), 11 | }, 12 | plugins: [ 13 | new webpack.DefinePlugin({ 14 | 'process.env': { 15 | NODE_ENV: JSON.stringify('production'), 16 | }, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 | 5 | 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/ssr/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/ssr/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/ssr/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /fixtures/ssr/server/render.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {renderToString} from 'react-dom/server'; 3 | 4 | import App from '../src/components/App'; 5 | 6 | let assets; 7 | if (process.env.NODE_ENV === 'development') { 8 | // Use the bundle from create-react-app's server in development mode. 9 | assets = { 10 | 'main.js': '/static/js/bundle.js', 11 | 'main.css': '', 12 | }; 13 | } else { 14 | assets = require('../build/asset-manifest.json'); 15 | } 16 | 17 | export default function render() { 18 | var html = renderToString(); 19 | // There's no way to render a doctype in React so prepend manually. 20 | // Also append a bootstrap script tag. 21 | return '' + html; 22 | } 23 | -------------------------------------------------------------------------------- /fixtures/ssr/src/components/Chrome.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 10px; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | 7 | body.light { 8 | background-color: #FFFFFF; 9 | color: #333333; 10 | } 11 | 12 | body.dark { 13 | background-color: #000000; 14 | color: #CCCCCC; 15 | } 16 | 17 | .light-loading { 18 | margin: 10px 0; 19 | padding: 10px; 20 | background-color: #CCCCCC; 21 | color: #666666; 22 | } 23 | 24 | .dark-loading { 25 | margin: 10px 0; 26 | padding: 10px; 27 | background-color: #333333; 28 | color: #999999; 29 | } 30 | -------------------------------------------------------------------------------- /fixtures/ssr/src/components/Page.css: -------------------------------------------------------------------------------- 1 | .link { 2 | font-weight: bold; 3 | cursor: pointer; 4 | } 5 | .light-box { 6 | margin: 10px 0; 7 | padding: 10px; 8 | background-color: #CCCCCC; 9 | color: #333333; 10 | } 11 | .dark-box { 12 | margin: 10px 0; 13 | padding: 10px; 14 | background-color: #333333; 15 | color: #CCCCCC; 16 | } 17 | -------------------------------------------------------------------------------- /fixtures/ssr/src/components/Page2.js: -------------------------------------------------------------------------------- 1 | import React, {useContext} from 'react'; 2 | 3 | import Theme from './Theme'; 4 | import Suspend from './Suspend'; 5 | 6 | import './Page.css'; 7 | 8 | export default function Page2() { 9 | let theme = useContext(Theme); 10 | return ( 11 |
    12 | Content of a different page 13 |
    14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/ssr/src/components/Suspend.js: -------------------------------------------------------------------------------- 1 | let promise = null; 2 | let isResolved = false; 3 | 4 | export default function Suspend({children}) { 5 | // This will suspend the content from rendering but only on the client. 6 | // This is used to demo a slow loading app. 7 | if (typeof window === 'object') { 8 | if (!isResolved) { 9 | if (promise === null) { 10 | promise = new Promise(resolve => { 11 | setTimeout(() => { 12 | isResolved = true; 13 | resolve(); 14 | }, 6000); 15 | }); 16 | } 17 | throw promise; 18 | } 19 | } 20 | return children; 21 | } 22 | -------------------------------------------------------------------------------- /fixtures/ssr/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {unstable_createRoot} from 'react-dom'; 3 | 4 | import App from './components/App'; 5 | 6 | let root = unstable_createRoot(document, {hydrate: true}); 7 | root.render(); 8 | -------------------------------------------------------------------------------- /fixtures/tracing/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test tracing UMD 6 | 11 | 12 | 13 |
    14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /fixtures/unstable-async/time-slicing/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://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 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /fixtures/unstable-async/time-slicing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cpu-demo", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "glamor": "^2.20.40", 7 | "react-markdown": "^3.2.0", 8 | "react-scripts": "^1.1.4", 9 | "victory": "^0.25.6" 10 | }, 11 | "scripts": { 12 | "prestart": "cp -r ../../../build/node_modules/* ./node_modules/", 13 | "prebuild": "cp -r ../../../build/node_modules/* ./node_modules/", 14 | "start": "react-scripts start", 15 | "build": "react-scripts build", 16 | "test": "react-scripts test --env=jsdom", 17 | "eject": "react-scripts eject" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /fixtures/unstable-async/time-slicing/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/fixtures/unstable-async/time-slicing/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/unstable-async/time-slicing/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/unstable-fire/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
    7 | 13 | 14 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |
    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "version": "0.0.1", 4 | "description": "react", 5 | "main": "dist/react.js", 6 | "scripts": { 7 | "start": "parcel ./index.html" 8 | }, 9 | "devDependencies": { 10 | "babel-core": "^6.26.0", 11 | "babel-plugin-transform-react-jsx": "^6.24.1", 12 | "babel-preset-env": "^1.6.1", 13 | "parcel-bundler": "^1.7.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/create-subscription/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/createSubscription'; 13 | -------------------------------------------------------------------------------- /packages/create-subscription/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/create-subscription.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/create-subscription.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/create-subscription/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-subscription", 3 | "description": "utility for subscribing to external data sources inside React components", 4 | "version": "16.8.6", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/facebook/react.git", 8 | "directory": "packages/create-subscription" 9 | }, 10 | "files": [ 11 | "LICENSE", 12 | "README.md", 13 | "build-info.json", 14 | "index.js", 15 | "cjs/" 16 | ], 17 | "peerDependencies": { 18 | "react": "^16.3.0" 19 | }, 20 | "devDependencies": { 21 | "rxjs": "^5.5.6" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/eslint-plugin-react-hooks/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | module.exports = require('./src/index'); 11 | -------------------------------------------------------------------------------- /packages/eslint-plugin-react-hooks/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // TODO: this doesn't make sense for an ESLint rule. 4 | // We need to fix our build process to not create bundles for "raw" packages like this. 5 | if (process.env.NODE_ENV === 'production') { 6 | module.exports = require('./cjs/eslint-plugin-react-hooks.production.min.js'); 7 | } else { 8 | module.exports = require('./cjs/eslint-plugin-react-hooks.development.js'); 9 | } 10 | -------------------------------------------------------------------------------- /packages/eslint-plugin-react-hooks/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import RuleOfHooks from './RulesOfHooks'; 11 | import ExhaustiveDeps from './ExhaustiveDeps'; 12 | 13 | export const rules = { 14 | 'rules-of-hooks': RuleOfHooks, 15 | 'exhaustive-deps': ExhaustiveDeps, 16 | }; 17 | -------------------------------------------------------------------------------- /packages/events/EventSystemFlags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 type EventSystemFlags = number; 11 | 12 | export const PLUGIN_EVENT_SYSTEM = 1; 13 | export const RESPONDER_EVENT_SYSTEM = 1 << 1; 14 | export const IS_PASSIVE = 1 << 2; 15 | export const IS_ACTIVE = 1 << 3; 16 | export const PASSIVE_NOT_SUPPORTED = 1 << 4; 17 | -------------------------------------------------------------------------------- /packages/events/ResponderSyntheticEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from './SyntheticEvent'; 9 | 10 | /** 11 | * `touchHistory` isn't actually on the native event, but putting it in the 12 | * interface will ensure that it is cleaned up when pooled/destroyed. The 13 | * `ResponderEventPlugin` will populate it appropriately. 14 | */ 15 | const ResponderSyntheticEvent = SyntheticEvent.extend({ 16 | touchHistory: function(nativeEvent) { 17 | return null; // Actually doesn't even look at the native event. 18 | }, 19 | }); 20 | 21 | export default ResponderSyntheticEvent; 22 | -------------------------------------------------------------------------------- /packages/events/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "events", 4 | "version": "0.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /packages/jest-mock-scheduler/README.md: -------------------------------------------------------------------------------- 1 | # `jest-mock-scheduler` 2 | 3 | Jest matchers and utilities for testing the `scheduler` package. 4 | 5 | This package is experimental. APIs may change between releases. -------------------------------------------------------------------------------- /packages/jest-mock-scheduler/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('scheduler/unstable_mock'); 4 | -------------------------------------------------------------------------------- /packages/jest-mock-scheduler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jest-mock-scheduler", 3 | "private": true, 4 | "version": "0.1.0", 5 | "description": "Jest matchers and utilities for testing the scheduler package.", 6 | "main": "index.js", 7 | "repository": { 8 | "type" : "git", 9 | "url" : "https://github.com/facebook/react.git", 10 | "directory": "packages/jest-mock-scheduler" 11 | }, 12 | "keywords": [ 13 | "jest", 14 | "scheduler" 15 | ], 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/facebook/react/issues" 19 | }, 20 | "homepage": "https://reactjs.org/", 21 | "peerDependencies": { 22 | "jest": "^23.0.1", 23 | "scheduler": "^0.11.0" 24 | }, 25 | "files": [ 26 | "LICENSE", 27 | "README.md", 28 | "build-info.json", 29 | "index.js", 30 | "cjs/" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /packages/jest-react/README.md: -------------------------------------------------------------------------------- 1 | # `jest-react` 2 | 3 | Jest matchers and utilities for testing React Test Renderer. -------------------------------------------------------------------------------- /packages/jest-react/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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/jest-react/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/jest-react.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/jest-react.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/jest-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jest-react", 3 | "version": "0.6.6", 4 | "description": "Jest matchers and utilities for testing React components.", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/facebook/react.git", 9 | "directory": "packages/jest-react" 10 | }, 11 | "keywords": [ 12 | "react", 13 | "jest", 14 | "react-testing" 15 | ], 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/facebook/react/issues" 19 | }, 20 | "homepage": "https://reactjs.org/", 21 | "peerDependencies": { 22 | "jest": "^23.0.1", 23 | "react": "^16.0.0", 24 | "react-test-renderer": "^16.0.0" 25 | }, 26 | "files": [ 27 | "LICENSE", 28 | "README.md", 29 | "build-info.json", 30 | "index.js", 31 | "cjs/" 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /packages/react-art/Circle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Circle = require('./npm/Circle'); 13 | 14 | module.exports = Circle; 15 | -------------------------------------------------------------------------------- /packages/react-art/README.md: -------------------------------------------------------------------------------- 1 | # React ART 2 | 3 | React ART is a JavaScript library for drawing vector graphics using [React](https://github.com/facebook/react/). 4 | 5 | It provides declarative and reactive bindings to the [ART library](https://github.com/sebmarkbage/art/). 6 | 7 | Using the same declarative API you can render the output to either Canvas, SVG or VML (IE8). 8 | -------------------------------------------------------------------------------- /packages/react-art/Rectangle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Rectangle = require('./npm/Rectangle'); 13 | 14 | module.exports = Rectangle; 15 | -------------------------------------------------------------------------------- /packages/react-art/Wedge.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Wedge = require('./npm/Wedge'); 13 | 14 | module.exports = Wedge; 15 | -------------------------------------------------------------------------------- /packages/react-art/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactART = require('./src/ReactART'); 13 | 14 | module.exports = ReactART; 15 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-art.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-cache/README.md: -------------------------------------------------------------------------------- 1 | # react-cache 2 | 3 | A basic cache for React applications. It also serves as a reference for more 4 | advanced caching implementations. 5 | 6 | This package is meant to be used alongside yet-to-be-released, experimental 7 | React features. It's unlikely to be useful in any other context. 8 | 9 | **Do not use in a real application.** We're publishing this early for 10 | demonstration purposes. 11 | 12 | **Use it at your own risk.** 13 | 14 | # No, Really, It Is Unstable 15 | 16 | The API ~~may~~ will change wildly between versions. 17 | -------------------------------------------------------------------------------- /packages/react-cache/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/ReactCache'; 13 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-cache.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-cache/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-cache", 4 | "description": "A basic cache for React applications", 5 | "version": "2.0.0-alpha.0", 6 | "repository": { 7 | "type" : "git", 8 | "url" : "https://github.com/facebook/react.git", 9 | "directory": "packages/react-cache" 10 | }, 11 | "files": [ 12 | "LICENSE", 13 | "README.md", 14 | "build-info.json", 15 | "index.js", 16 | "cjs/", 17 | "umd/" 18 | ], 19 | "peerDependencies": { 20 | "react": "^16.3.0-alpha.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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-debug-tools/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const ReactDebugTools = require('./src/ReactDebugTools'); 11 | 12 | // This is hacky but makes it work with both Rollup and Jest. 13 | module.exports = ReactDebugTools.default || ReactDebugTools; 14 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-debug-tools.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-debug-tools/src/ReactDebugTools.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import {inspectHooks, inspectHooksOfFiber} from './ReactDebugHooks'; 11 | 12 | export {inspectHooks, inspectHooksOfFiber}; 13 | -------------------------------------------------------------------------------- /packages/react-dom/index.fb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const ReactDOMFB = require('./src/client/ReactDOMFB'); 11 | 12 | // TODO: decide on the top-level export form. 13 | // This is hacky but makes it work with both Rollup and Jest. 14 | module.exports = ReactDOMFB.default || ReactDOMFB; 15 | -------------------------------------------------------------------------------- /packages/react-dom/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOM = require('./src/client/ReactDOM'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactDOM.default || ReactDOM; 17 | -------------------------------------------------------------------------------- /packages/react-dom/npm/server.browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-server.browser.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-server.browser.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-dom/npm/server.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./server.node'); 4 | -------------------------------------------------------------------------------- /packages/react-dom/npm/server.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-server.node.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-server.node.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-test-utils.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-dom/npm/unstable-fizz.browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-unstable-fizz.browser.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-unstable-fizz.browser.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-dom/npm/unstable-fizz.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./unstable-fizz.node'); 4 | -------------------------------------------------------------------------------- /packages/react-dom/npm/unstable-fizz.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-unstable-fizz.node.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-unstable-fizz.node.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-dom/npm/unstable-native-dependencies.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-unstable-native-dependencies.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-unstable-native-dependencies.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-dom/server.browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOMServer = require('./src/server/ReactDOMServerBrowser'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest 16 | module.exports = ReactDOMServer.default || ReactDOMServer; 17 | -------------------------------------------------------------------------------- /packages/react-dom/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | module.exports = require('./server.node'); 13 | -------------------------------------------------------------------------------- /packages/react-dom/server.node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOMServer = require('./src/server/ReactDOMServerNode'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest 16 | module.exports = ReactDOMServer.default || ReactDOMServer; 17 | -------------------------------------------------------------------------------- /packages/react-dom/src/client/getActiveElement.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 function getActiveElement(doc: ?Document): ?Element { 11 | doc = doc || (typeof document !== 'undefined' ? document : undefined); 12 | if (typeof doc === 'undefined') { 13 | return null; 14 | } 15 | try { 16 | return doc.activeElement || doc.body; 17 | } catch (e) { 18 | return doc.body; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticAnimationEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | /** 11 | * @interface Event 12 | * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface 13 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent 14 | */ 15 | const SyntheticAnimationEvent = SyntheticEvent.extend({ 16 | animationName: null, 17 | elapsedTime: null, 18 | pseudoElement: null, 19 | }); 20 | 21 | export default SyntheticAnimationEvent; 22 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticClipboardEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | /** 11 | * @interface Event 12 | * @see http://www.w3.org/TR/clipboard-apis/ 13 | */ 14 | const SyntheticClipboardEvent = SyntheticEvent.extend({ 15 | clipboardData: function(event) { 16 | return 'clipboardData' in event 17 | ? event.clipboardData 18 | : window.clipboardData; 19 | }, 20 | }); 21 | 22 | export default SyntheticClipboardEvent; 23 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticCompositionEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | /** 11 | * @interface Event 12 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents 13 | */ 14 | const SyntheticCompositionEvent = SyntheticEvent.extend({ 15 | data: null, 16 | }); 17 | 18 | export default SyntheticCompositionEvent; 19 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticDragEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticMouseEvent from './SyntheticMouseEvent'; 9 | 10 | /** 11 | * @interface DragEvent 12 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ 13 | */ 14 | const SyntheticDragEvent = SyntheticMouseEvent.extend({ 15 | dataTransfer: null, 16 | }); 17 | 18 | export default SyntheticDragEvent; 19 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticFocusEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticUIEvent from './SyntheticUIEvent'; 9 | 10 | /** 11 | * @interface FocusEvent 12 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ 13 | */ 14 | const SyntheticFocusEvent = SyntheticUIEvent.extend({ 15 | relatedTarget: null, 16 | }); 17 | 18 | export default SyntheticFocusEvent; 19 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticInputEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | /** 11 | * @interface Event 12 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 13 | * /#events-inputevents 14 | */ 15 | const SyntheticInputEvent = SyntheticEvent.extend({ 16 | data: null, 17 | }); 18 | 19 | export default SyntheticInputEvent; 20 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticPointerEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticMouseEvent from './SyntheticMouseEvent'; 9 | 10 | /** 11 | * @interface PointerEvent 12 | * @see http://www.w3.org/TR/pointerevents/ 13 | */ 14 | const SyntheticPointerEvent = SyntheticMouseEvent.extend({ 15 | pointerId: null, 16 | width: null, 17 | height: null, 18 | pressure: null, 19 | tangentialPressure: null, 20 | tiltX: null, 21 | tiltY: null, 22 | twist: null, 23 | pointerType: null, 24 | isPrimary: null, 25 | }); 26 | 27 | export default SyntheticPointerEvent; 28 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticTouchEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticUIEvent from './SyntheticUIEvent'; 9 | import getEventModifierState from './getEventModifierState'; 10 | 11 | /** 12 | * @interface TouchEvent 13 | * @see http://www.w3.org/TR/touch-events/ 14 | */ 15 | const SyntheticTouchEvent = SyntheticUIEvent.extend({ 16 | touches: null, 17 | targetTouches: null, 18 | changedTouches: null, 19 | altKey: null, 20 | metaKey: null, 21 | ctrlKey: null, 22 | shiftKey: null, 23 | getModifierState: getEventModifierState, 24 | }); 25 | 26 | export default SyntheticTouchEvent; 27 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticTransitionEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | /** 11 | * @interface Event 12 | * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- 13 | * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent 14 | */ 15 | const SyntheticTransitionEvent = SyntheticEvent.extend({ 16 | propertyName: null, 17 | elapsedTime: null, 18 | pseudoElement: null, 19 | }); 20 | 21 | export default SyntheticTransitionEvent; 22 | -------------------------------------------------------------------------------- /packages/react-dom/src/events/SyntheticUIEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import SyntheticEvent from 'events/SyntheticEvent'; 9 | 10 | const SyntheticUIEvent = SyntheticEvent.extend({ 11 | view: null, 12 | detail: null, 13 | }); 14 | 15 | export default SyntheticUIEvent; 16 | -------------------------------------------------------------------------------- /packages/react-dom/src/fire/ReactFireHostConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This is just to get the setup running. 11 | // TODO: real implementation. 12 | // console.log('Hello from Fire host config.'); 13 | 14 | export * from '../client/ReactDOMHostConfig'; 15 | -------------------------------------------------------------------------------- /packages/react-dom/src/server/ReactDOMFizzServerFormatConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import {convertStringToBuffer} from 'react-stream/src/ReactFizzHostConfig'; 11 | 12 | export function formatChunk(type: string, props: Object): Uint8Array { 13 | let str = '<' + type + '>'; 14 | if (typeof props.children === 'string') { 15 | str += props.children; 16 | } 17 | str += ''; 18 | return convertStringToBuffer(str); 19 | } 20 | -------------------------------------------------------------------------------- /packages/react-dom/src/server/ReactDOMServerNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import ReactVersion from 'shared/ReactVersion'; 9 | 10 | import {renderToString, renderToStaticMarkup} from './ReactDOMStringRenderer'; 11 | import { 12 | renderToNodeStream, 13 | renderToStaticNodeStream, 14 | } from './ReactDOMNodeStreamRenderer'; 15 | 16 | // Note: when changing this, also consider https://github.com/facebook/react/issues/11526 17 | export default { 18 | renderToString, 19 | renderToStaticMarkup, 20 | renderToNodeStream, 21 | renderToStaticNodeStream, 22 | version: ReactVersion, 23 | }; 24 | -------------------------------------------------------------------------------- /packages/react-dom/src/server/quoteAttributeValueForBrowser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import escapeTextForBrowser from './escapeTextForBrowser'; 9 | 10 | /** 11 | * Escapes attribute value to prevent scripting attacks. 12 | * 13 | * @param {*} value Value to escape. 14 | * @return {string} An escaped string. 15 | */ 16 | function quoteAttributeValueForBrowser(value) { 17 | return '"' + escapeTextForBrowser(value) + '"'; 18 | } 19 | 20 | export default quoteAttributeValueForBrowser; 21 | -------------------------------------------------------------------------------- /packages/react-dom/src/shared/HTMLNodeType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | /** 11 | * HTML nodeType values that represent the type of the node 12 | */ 13 | 14 | export const ELEMENT_NODE = 1; 15 | export const TEXT_NODE = 3; 16 | export const COMMENT_NODE = 8; 17 | export const DOCUMENT_NODE = 9; 18 | export const DOCUMENT_FRAGMENT_NODE = 11; 19 | -------------------------------------------------------------------------------- /packages/react-dom/src/shared/checkReact.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import React from 'react'; 11 | import invariant from 'shared/invariant'; 12 | 13 | invariant( 14 | React, 15 | 'ReactDOM was loaded before React. Make sure you load ' + 16 | 'the React package before loading ReactDOM.', 17 | ); 18 | -------------------------------------------------------------------------------- /packages/react-dom/src/shared/createMicrosoftUnsafeLocalFunction.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | /* globals MSApp */ 9 | 10 | /** 11 | * Create a function which has 'unsafe' privileges (required by windows8 apps) 12 | */ 13 | const createMicrosoftUnsafeLocalFunction = function(func) { 14 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { 15 | return function(arg0, arg1, arg2, arg3) { 16 | MSApp.execUnsafeLocalFunction(function() { 17 | return func(arg0, arg1, arg2, arg3); 18 | }); 19 | }; 20 | } else { 21 | return func; 22 | } 23 | }; 24 | 25 | export default createMicrosoftUnsafeLocalFunction; 26 | -------------------------------------------------------------------------------- /packages/react-dom/src/shared/omittedCloseTags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // For HTML, certain tags should omit their close tag. We keep a whitelist for 9 | // those special-case tags. 10 | 11 | const omittedCloseTags = { 12 | area: true, 13 | base: true, 14 | br: true, 15 | col: true, 16 | embed: true, 17 | hr: true, 18 | img: true, 19 | input: true, 20 | keygen: true, 21 | link: true, 22 | meta: true, 23 | param: true, 24 | source: true, 25 | track: true, 26 | wbr: true, 27 | // NOTE: menuitem's close tag should be omitted, but that causes problems. 28 | }; 29 | 30 | export default omittedCloseTags; 31 | -------------------------------------------------------------------------------- /packages/react-dom/src/shared/voidElementTags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import omittedCloseTags from './omittedCloseTags'; 9 | 10 | // For HTML, certain tags cannot have children. This has the same purpose as 11 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. 12 | 13 | const voidElementTags = { 14 | menuitem: true, 15 | ...omittedCloseTags, 16 | }; 17 | 18 | export default voidElementTags; 19 | -------------------------------------------------------------------------------- /packages/react-dom/test-utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactTestUtils = require('./src/test-utils/ReactTestUtils'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactTestUtils.default || ReactTestUtils; 17 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-fire.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactFire = require('./src/fire/ReactFire'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactFire.default || ReactFire; 17 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-fizz.browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOMFizzServerBrowser = require('./src/server/ReactDOMFizzServerBrowser'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest 16 | module.exports = ReactDOMFizzServerBrowser.default || ReactDOMFizzServerBrowser; 17 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-fizz.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | module.exports = require('./unstable-fizz.node'); 13 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-fizz.node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOMFizzServerNode = require('./src/server/ReactDOMFizzServerNode'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest 16 | module.exports = ReactDOMFizzServerNode.default || ReactDOMFizzServerNode; 17 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-native-dependencies.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | module.exports = require('./src/unstable-native-dependencies/ReactDOMUnstableNativeDependencies'); 13 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-new-scheduler.fb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const ReactDOMFB = require('./src/client/ReactDOMFB'); 11 | 12 | // TODO: decide on the top-level export form. 13 | // This is hacky but makes it work with both Rollup and Jest. 14 | module.exports = ReactDOMFB.default || ReactDOMFB; 15 | -------------------------------------------------------------------------------- /packages/react-dom/unstable-new-scheduler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactDOM = require('./src/client/ReactDOM'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactDOM.default || ReactDOM; 17 | -------------------------------------------------------------------------------- /packages/react-events/drag.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Drag = require('./src/Drag'); 13 | 14 | module.exports = Drag.default || Drag; 15 | -------------------------------------------------------------------------------- /packages/react-events/focus.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Focus = require('./src/Focus'); 13 | 14 | module.exports = Focus.default || Focus; 15 | -------------------------------------------------------------------------------- /packages/react-events/hover.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Hover = require('./src/Hover'); 13 | 14 | module.exports = Hover.default || Hover; 15 | -------------------------------------------------------------------------------- /packages/react-events/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/ReactEvents'; 13 | -------------------------------------------------------------------------------- /packages/react-events/npm/drag.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events-drag.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events-drag.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/npm/focus.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events-focus.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events-focus.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/npm/hover.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events-hover.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events-hover.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/npm/press.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events-press.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events-press.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/npm/swipe.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-events-swipe.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-events-swipe.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-events/press.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Press = require('./src/Press'); 13 | 14 | module.exports = Press.default || Press; 15 | -------------------------------------------------------------------------------- /packages/react-events/src/ReactEvents.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import { 11 | REACT_EVENT_TARGET_TYPE, 12 | REACT_EVENT_TARGET_TOUCH_HIT, 13 | } from 'shared/ReactSymbols'; 14 | import type {ReactEventTarget} from 'shared/ReactTypes'; 15 | 16 | export const TouchHitTarget: ReactEventTarget = { 17 | $$typeof: REACT_EVENT_TARGET_TYPE, 18 | type: REACT_EVENT_TARGET_TOUCH_HIT, 19 | }; 20 | -------------------------------------------------------------------------------- /packages/react-events/swipe.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const Swipe = require('./src/Swipe'); 13 | 14 | module.exports = Swipe.default || Swipe; 15 | -------------------------------------------------------------------------------- /packages/react-is/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/ReactIs'; 13 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-is.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-is/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-is", 3 | "version": "16.8.6", 4 | "description": "Brand checking of React Elements.", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/facebook/react.git", 9 | "directory": "packages/react-is" 10 | }, 11 | "keywords": [ 12 | "react" 13 | ], 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/facebook/react/issues" 17 | }, 18 | "homepage": "https://reactjs.org/", 19 | "files": [ 20 | "LICENSE", 21 | "README.md", 22 | "build-info.json", 23 | "index.js", 24 | "cjs/", 25 | "umd/" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/react-native-renderer/fabric.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactFabric = require('./src/ReactFabric'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactFabric.default || ReactFabric; 17 | -------------------------------------------------------------------------------- /packages/react-native-renderer/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactNativeRenderer = require('./src/ReactNativeRenderer'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactNativeRenderer.default || ReactNativeRenderer; 17 | -------------------------------------------------------------------------------- /packages/react-native-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-renderer", 3 | "version": "16.0.0", 4 | "private": true, 5 | "repository": { 6 | "type" : "git", 7 | "url" : "https://github.com/facebook/react.git", 8 | "directory": "packages/react-native-renderer" 9 | }, 10 | "dependencies": { 11 | "object-assign": "^4.1.1", 12 | "prop-types": "^15.6.2", 13 | "scheduler": "^0.11.0" 14 | }, 15 | "peerDependencies": { 16 | "react": "^16.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // Module provided by RN: 11 | import UIManager from 'UIManager'; 12 | 13 | const ReactFabricGlobalResponderHandler = { 14 | onChange: function(from: any, to: any, blockNativeResponder: boolean) { 15 | if (to !== null) { 16 | const tag = to.stateNode.canonical._nativeTag; 17 | UIManager.setJSResponder(tag, blockNativeResponder); 18 | } else { 19 | UIManager.clearJSResponder(); 20 | } 21 | }, 22 | }; 23 | 24 | export default ReactFabricGlobalResponderHandler; 25 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/ReactNativeEventPluginOrder.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const ReactNativeEventPluginOrder = [ 11 | 'ResponderEventPlugin', 12 | 'ReactNativeBridgeEventPlugin', 13 | ]; 14 | 15 | export default ReactNativeEventPluginOrder; 16 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/ReactNativeGlobalResponderHandler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // Module provided by RN: 11 | import UIManager from 'UIManager'; 12 | 13 | const ReactNativeGlobalResponderHandler = { 14 | onChange: function(from: any, to: any, blockNativeResponder: boolean) { 15 | if (to !== null) { 16 | const tag = to.stateNode._nativeTag; 17 | UIManager.setJSResponder(tag, blockNativeResponder); 18 | } else { 19 | UIManager.clearJSResponder(); 20 | } 21 | }, 22 | }; 23 | 24 | export default ReactNativeGlobalResponderHandler; 25 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/BatchedBridge.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const BatchedBridge = { 11 | registerCallableModule: jest.fn(), 12 | }; 13 | 14 | module.exports = BatchedBridge; 15 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/ExceptionsManager.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | module.exports = { 11 | handleException: jest.fn(), 12 | }; 13 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/InitializeCore.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // Noop 11 | 12 | // TODO #10932517: Move all initialization callers back into react-native 13 | 14 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/Platform.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 8 | 9 | module.exports = { 10 | OS: 'ios', 11 | }; 12 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/RCTEventEmitter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const RCTEventEmitter = { 11 | register: jest.fn(), 12 | }; 13 | 14 | module.exports = RCTEventEmitter; 15 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/TextInputState.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // Mock of the Native Hooks 11 | // TODO: Should this move into the components themselves? E.g. focusable 12 | 13 | const TextInputState = {}; 14 | 15 | module.exports = TextInputState; 16 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/deepFreezeAndThrowOnMutationInDev.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // TODO: move into react or fbjs 11 | 12 | const deepFreezeAndThrowOnMutationInDev = function() {}; 13 | 14 | module.exports = deepFreezeAndThrowOnMutationInDev; 15 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/flattenStyle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // TODO: Move flattenStyle into react 11 | 12 | const flattenStyle = function() {}; 13 | 14 | module.exports = flattenStyle; 15 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__tests__/__snapshots__/ReactNativeEvents-test.internal.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`fails if unknown/unsupported event types are dispatched 1`] = ` 4 | " {} 5 | View null" 6 | `; 7 | 8 | exports[`handles events 1`] = ` 9 | " {} 10 | View {\\"foo\\":\\"outer\\"} 11 | View {\\"foo\\":\\"inner\\"}" 12 | `; 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactNoop = require('./src/ReactNoop'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactNoop.default || ReactNoop; 17 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer-persistent.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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer-server.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-noop-renderer", 3 | "version": "16.0.0", 4 | "private": true, 5 | "description": "React package for testing the Fiber reconciler.", 6 | "main": "index.js", 7 | "repository": { 8 | "type" : "git", 9 | "url" : "https://github.com/facebook/react.git", 10 | "directory": "packages/react-noop-renderer" 11 | }, 12 | "license": "MIT", 13 | "dependencies": { 14 | "object-assign": "^4.1.1", 15 | "prop-types": "^15.6.2", 16 | "regenerator-runtime": "^0.11.0", 17 | "react-reconciler": "*", 18 | "react-stream": "*" 19 | }, 20 | "peerDependencies": { 21 | "react": "^16.0.0" 22 | }, 23 | "files": [ 24 | "LICENSE", 25 | "README.md", 26 | "build-info.json", 27 | "index.js", 28 | "persistent.js", 29 | "server.js", 30 | "cjs/" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/persistent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactNoopPersistent = require('./src/ReactNoopPersistent'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactNoopPersistent.default || ReactNoopPersistent; 17 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/server.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactNoopServer = require('./src/ReactNoopServer'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactNoopServer.default || ReactNoopServer; 17 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/src/ReactNoop.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | /** 11 | * This is a renderer of React that doesn't have a render target output. 12 | * It is useful to demonstrate the internals of the reconciler in isolation 13 | * and for testing semantics of reconciliation separate from the host 14 | * environment. 15 | */ 16 | 17 | import ReactFiberReconciler from 'react-reconciler'; 18 | import createReactNoop from './createReactNoop'; 19 | 20 | const ReactNoop = createReactNoop( 21 | ReactFiberReconciler, // reconciler 22 | true, // useMutation 23 | ); 24 | 25 | export default ReactNoop; 26 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.art.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.dom-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.fabric.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.fire.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.native.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-reconciler/inline.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-reconciler.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-reconciler/npm/persistent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-reconciler-persistent.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-reconciler-persistent.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-reconciler-reflection.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-reconciler/persistent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This is the same export as in index.js, 11 | // with persistent reconciler flags turned on. 12 | const ReactFiberReconciler = require('./src/ReactFiberReconciler'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactFiberReconciler.default || ReactFiberReconciler; 17 | -------------------------------------------------------------------------------- /packages/react-reconciler/reflection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/ReactFiberTreeReflection'; 13 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberErrorDialog.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import type {CapturedError} from './ReactCapturedValue'; 11 | 12 | // This module is forked in different environments. 13 | // By default, return `true` to log errors to the console. 14 | // Forks can return `false` if this isn't desirable. 15 | export function showErrorDialog(capturedError: CapturedError): boolean { 16 | return true; 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberHostConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import invariant from 'shared/invariant'; 11 | 12 | // We expect that our Rollup, Jest, and Flow configurations 13 | // always shim this module with the corresponding host config 14 | // (either provided by a renderer, or a generic shim for npm). 15 | // 16 | // We should never resolve to this file, but it exists to make 17 | // sure that if we *do* accidentally break the configuration, 18 | // the failure isn't silent. 19 | 20 | invariant(false, 'This module must be shimmed by a specific renderer.'); 21 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberInstrumentation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This lets us hook into Fiber to debug what it's doing. 11 | // See https://github.com/facebook/react/pull/8033. 12 | // This is not part of the public API, not even for React DevTools. 13 | // You may only inject a debugTool if you work on React Fiber itself. 14 | const ReactFiberInstrumentation = { 15 | debugTool: null, 16 | }; 17 | 18 | module.exports = ReactFiberInstrumentation; 19 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactHookEffectTags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 type HookEffectTag = number; 11 | 12 | export const NoEffect = /* */ 0b00000000; 13 | export const UnmountSnapshot = /* */ 0b00000010; 14 | export const UnmountMutation = /* */ 0b00000100; 15 | export const MountMutation = /* */ 0b00001000; 16 | export const UnmountLayout = /* */ 0b00010000; 17 | export const MountLayout = /* */ 0b00100000; 18 | export const MountPassive = /* */ 0b01000000; 19 | export const UnmountPassive = /* */ 0b10000000; 20 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactTypeOfMode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 type TypeOfMode = number; 11 | 12 | export const NoContext = 0b000; 13 | export const ConcurrentMode = 0b001; 14 | export const StrictMode = 0b010; 15 | export const ProfileMode = 0b100; 16 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/__tests__/__snapshots__/ReactHooks-test.internal.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ReactHooks works with ReactDOMServer calls inside a component 1`] = `"

    hello

    0

    bye

    "`; 4 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberErrorDialog.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import type {CapturedError} from '../ReactCapturedValue'; 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // Provided by www 15 | const ReactFiberErrorDialogWWW = require('ReactFiberErrorDialog'); 16 | invariant( 17 | typeof ReactFiberErrorDialogWWW.showErrorDialog === 'function', 18 | 'Expected ReactFiberErrorDialog.showErrorDialog to be a function.', 19 | ); 20 | 21 | export function showErrorDialog(capturedError: CapturedError): boolean { 22 | return ReactFiberErrorDialogWWW.showErrorDialog(capturedError); 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.art.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-art/src/ReactARTHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.dom-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-dom/src/client/ReactDOMHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-dom/src/client/ReactDOMHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.fabric.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-native-renderer/src/ReactFabricHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.fire.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-dom/src/fire/ReactFireHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.native.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-native-renderer/src/ReactNativeHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/forks/ReactFiberHostConfig.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-test-renderer/src/ReactTestHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/maxSigned31BitInt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // Max 31 bit integer. The max integer size in V8 for 32-bit systems. 11 | // Math.pow(2, 30) - 1 12 | // 0b111111111111111111111111111111 13 | export default 1073741823; 14 | -------------------------------------------------------------------------------- /packages/react-stream/README.md: -------------------------------------------------------------------------------- 1 | # react-stream 2 | 3 | This is an experimental package for creating custom React streaming server 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 | 9 | ## API 10 | 11 | ```js 12 | var Renderer = require('react-stream'); 13 | 14 | var HostConfig = { 15 | // You'll need to implement some methods here. 16 | // See below for more information and examples. 17 | }; 18 | 19 | var MyRenderer = Renderer(HostConfig); 20 | 21 | var RendererPublicAPI = { 22 | }; 23 | 24 | module.exports = RendererPublicAPI; 25 | ``` 26 | -------------------------------------------------------------------------------- /packages/react-stream/inline.dom-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFizzStreamer'; 12 | -------------------------------------------------------------------------------- /packages/react-stream/inline.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This file intentionally does *not* have the Flow annotation. 9 | // Don't add it. See `./inline-typed.js` for an explanation. 10 | 11 | export * from './src/ReactFizzStreamer'; 12 | -------------------------------------------------------------------------------- /packages/react-stream/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-stream.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-stream.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-stream/src/ReactFizzFormatConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import invariant from 'shared/invariant'; 11 | 12 | // We expect that our Rollup, Jest, and Flow configurations 13 | // always shim this module with the corresponding host config 14 | // (either provided by a renderer, or a generic shim for npm). 15 | // 16 | // We should never resolve to this file, but it exists to make 17 | // sure that if we *do* accidentally break the configuration, 18 | // the failure isn't silent. 19 | 20 | invariant(false, 'This module must be shimmed by a specific renderer.'); 21 | -------------------------------------------------------------------------------- /packages/react-stream/src/ReactFizzHostConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import invariant from 'shared/invariant'; 11 | 12 | // We expect that our Rollup, Jest, and Flow configurations 13 | // always shim this module with the corresponding host config 14 | // (either provided by a renderer, or a generic shim for npm). 15 | // 16 | // We should never resolve to this file, but it exists to make 17 | // sure that if we *do* accidentally break the configuration, 18 | // the failure isn't silent. 19 | 20 | invariant(false, 'This module must be shimmed by a specific renderer.'); 21 | -------------------------------------------------------------------------------- /packages/react-stream/src/__tests__/ReactServer-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @emails react-core 8 | * @jest-environment node 9 | */ 10 | 11 | 'use strict'; 12 | 13 | let React; 14 | let ReactNoopServer; 15 | 16 | describe('ReactServer', () => { 17 | beforeEach(() => { 18 | jest.resetModules(); 19 | 20 | React = require('react'); 21 | ReactNoopServer = require('react-noop-renderer/server'); 22 | }); 23 | 24 | it('can call render', () => { 25 | let result = ReactNoopServer.render(
    hello world
    ); 26 | expect(result).toEqual([{type: 'div', props: {children: 'hello world'}}]); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /packages/react-stream/src/forks/ReactFizzFormatConfig.dom-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-dom/src/server/ReactDOMFizzServerFormatConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-stream/src/forks/ReactFizzFormatConfig.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 'react-dom/src/server/ReactDOMFizzServerFormatConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-stream/src/forks/ReactFizzHostConfig.dom-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 '../ReactFizzHostConfigBrowser'; 11 | -------------------------------------------------------------------------------- /packages/react-stream/src/forks/ReactFizzHostConfig.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 '../ReactFizzHostConfigNode'; 11 | -------------------------------------------------------------------------------- /packages/react-test-renderer/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactTestRenderer = require('./src/ReactTestRenderer'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactTestRenderer.default || ReactTestRenderer; 17 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-test-renderer.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-test-renderer/npm/shallow.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-test-renderer-shallow.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-test-renderer-shallow.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-test-renderer/shallow.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const ReactShallowRenderer = require('./src/ReactShallowRenderer'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = ReactShallowRenderer.default || ReactShallowRenderer; 17 | -------------------------------------------------------------------------------- /packages/react/README.md: -------------------------------------------------------------------------------- 1 | # `react` 2 | 3 | React is a JavaScript library for creating user interfaces. 4 | 5 | The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments. 6 | 7 | **Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application. 8 | 9 | ## Example Usage 10 | 11 | ```js 12 | var React = require('react'); 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/react/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | const React = require('./src/React'); 13 | 14 | // TODO: decide on the top-level export form. 15 | // This is hacky but makes it work with both Rollup and Jest. 16 | module.exports = React.default || React; 17 | -------------------------------------------------------------------------------- /packages/react/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/src/ReactCreateRef.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @flow 7 | */ 8 | 9 | import type {RefObject} from 'shared/ReactTypes'; 10 | 11 | // an immutable object with a single mutable value 12 | // 这个代码是不是贼简单,就是让你外部能够通过 current 去拿到 ref 13 | // 但是可能很多人没见过 Object.seal 这个 API 14 | // 直接给不清楚的各位复制了文档:封闭一个对象,阻止添加新属性并将所有现有属性标记为不可配置 15 | export function createRef(): RefObject { 16 | const refObject = { 17 | current: null, 18 | }; 19 | if (__DEV__) { 20 | Object.seal(refObject); 21 | } 22 | return refObject; 23 | } 24 | -------------------------------------------------------------------------------- /packages/react/src/ReactCurrentDispatcher.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import type {Dispatcher} from 'react-reconciler/src/ReactFiberHooks'; 11 | 12 | /** 13 | * Keeps track of the current dispatcher. 14 | */ 15 | const ReactCurrentDispatcher = { 16 | /** 17 | * @internal 18 | * @type {ReactComponent} 19 | */ 20 | current: (null: null | Dispatcher), 21 | }; 22 | 23 | export default ReactCurrentDispatcher; 24 | -------------------------------------------------------------------------------- /packages/react/src/ReactCurrentOwner.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import type {Fiber} from 'react-reconciler/src/ReactFiber'; 11 | 12 | /** 13 | * Keeps track of the current owner. 14 | * 15 | * The current owner is the component who should own any components that are 16 | * currently being constructed. 17 | */ 18 | const ReactCurrentOwner = { 19 | /** 20 | * @internal 21 | * @type {ReactComponent} 22 | */ 23 | current: (null: null | Fiber), 24 | }; 25 | 26 | export default ReactCurrentOwner; 27 | -------------------------------------------------------------------------------- /packages/react/src/__tests__/testDefinitions/PropTypes.d.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) Facebook, Inc. and its 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 | /** 9 | * TypeScript Definition File for React. 10 | * 11 | * Full type definitions are not yet officially supported. These are mostly 12 | * just helpers for the unit test. 13 | */ 14 | 15 | declare module 'prop-types' { 16 | export let string : any; 17 | } 18 | -------------------------------------------------------------------------------- /packages/react/src/__tests__/testDefinitions/ReactDOM.d.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) Facebook, Inc. and its 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 | /** 9 | * TypeScript Definition File for React. 10 | * 11 | * Full type definitions are not yet officially supported. These are mostly 12 | * just helpers for the unit test. 13 | */ 14 | 15 | declare module 'react-dom' { 16 | export function render(element : any, container : any) : any 17 | export function unmountComponentAtNode(container : any) : void 18 | export function findDOMNode(instance : any) : any 19 | } 20 | -------------------------------------------------------------------------------- /packages/react/src/forks/ReactCurrentDispatcher.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 require('ReactCurrentDispatcher'); 9 | -------------------------------------------------------------------------------- /packages/react/src/forks/ReactCurrentOwner.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 require('ReactCurrentOwner'); 9 | -------------------------------------------------------------------------------- /packages/scheduler/README.md: -------------------------------------------------------------------------------- 1 | # `scheduler` 2 | 3 | This is a package for cooperative scheduling in a browser environment. It is currently used internally by React, but we plan to make it more generic. 4 | 5 | The public API for this package is not yet finalized. 6 | 7 | ### Thanks 8 | 9 | The React team thanks [Anton Podviaznikov](https://podviaznikov.com/) for donating the `scheduler` package name. 10 | -------------------------------------------------------------------------------- /packages/scheduler/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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/Scheduler'; 11 | -------------------------------------------------------------------------------- /packages/scheduler/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/scheduler/npm/tracing-profiling.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler-tracing.profiling.min.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler-tracing.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/scheduler/npm/tracing.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler-tracing.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler-tracing.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /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.min.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler-unstable_mock.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/scheduler/src/SchedulerFeatureFlags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 9 | export const enableSchedulerDebugging = false; 10 | -------------------------------------------------------------------------------- /packages/scheduler/src/SchedulerHostConfig.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | throw new Error('This module must be shimmed by a specific build.'); 11 | -------------------------------------------------------------------------------- /packages/scheduler/src/forks/SchedulerFeatureFlags.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 9 | export const enableSchedulerDebugging = true; 10 | -------------------------------------------------------------------------------- /packages/scheduler/tracing.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 11 | 12 | export * from './src/Tracing'; 13 | export * from './src/TracingSubscriptions'; 14 | -------------------------------------------------------------------------------- /packages/scheduler/unstable_mock.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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/Scheduler'; 11 | 12 | export { 13 | unstable_flushWithoutYielding, 14 | unstable_flushNumberOfYields, 15 | unstable_flushExpired, 16 | unstable_clearYields, 17 | flushAll, 18 | yieldValue, 19 | advanceTime, 20 | } from './src/SchedulerHostConfig.js'; 21 | -------------------------------------------------------------------------------- /packages/shared/ExecutionEnvironment.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 const canUseDOM: boolean = !!( 11 | typeof window !== 'undefined' && 12 | window.document && 13 | window.document.createElement 14 | ); 15 | -------------------------------------------------------------------------------- /packages/shared/ReactElementType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 type Source = { 11 | fileName: string, 12 | lineNumber: number, 13 | }; 14 | 15 | export type ReactElement = { 16 | $$typeof: any, 17 | type: any, 18 | key: any, 19 | ref: any, 20 | props: any, 21 | _owner: any, // ReactInstance or ReactFiber 22 | 23 | // __DEV__ 24 | _store: { 25 | validated: boolean, 26 | }, 27 | _self: React$Element, 28 | _shadowChildren: any, 29 | _source: Source, 30 | }; 31 | -------------------------------------------------------------------------------- /packages/shared/ReactError.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 9 | // Do not require this module directly! Use a normal error constructor with 10 | // template literal strings. The messages will be converted to ReactError during 11 | // build, and in production they will be minified. 12 | 13 | function ReactError(message) { 14 | const error = new Error(message); 15 | error.name = 'Invariant Violation'; 16 | return error; 17 | } 18 | 19 | export default ReactError; 20 | -------------------------------------------------------------------------------- /packages/shared/ReactSharedInternals.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import React from 'react'; 9 | 10 | const ReactSharedInternals = 11 | React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 12 | 13 | // Prevent newer renderers from RTE when used with older react package versions. 14 | // Current owner and dispatcher used to share the same ref, 15 | // but PR #14548 split them out to better support the react-debug-tools package. 16 | if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { 17 | ReactSharedInternals.ReactCurrentDispatcher = { 18 | current: null, 19 | }; 20 | } 21 | 22 | export default ReactSharedInternals; 23 | -------------------------------------------------------------------------------- /packages/shared/ReactVersion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // TODO: this is special because it gets imported during build. 11 | module.exports = '16.8.6'; 12 | -------------------------------------------------------------------------------- /packages/shared/forks/ReactFeatureFlags.readonly.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | // This is only used by bundle tests so they can *read* the default feature flags. 9 | // It lets us determine whether we're running in Fire mode without making tests internal. 10 | const ReactFeatureFlags = require('../ReactFeatureFlags'); 11 | // Forbid writes because this wouldn't work with bundle tests. 12 | module.exports = Object.freeze({...ReactFeatureFlags}); 13 | -------------------------------------------------------------------------------- /packages/shared/forks/lowPriorityWarning.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 require('lowPriorityWarning'); 9 | -------------------------------------------------------------------------------- /packages/shared/forks/object-assign.umd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | import React from 'react'; 11 | 12 | const ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 13 | 14 | export default ReactInternals.assign; 15 | -------------------------------------------------------------------------------- /packages/shared/forks/warningWithoutStack.www.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 require('warning'); 9 | -------------------------------------------------------------------------------- /packages/shared/objectIs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | /** 11 | * inlined Object.is polyfill to avoid requiring consumers ship their own 12 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 13 | */ 14 | function is(x: any, y: any) { 15 | return ( 16 | (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare 17 | ); 18 | } 19 | 20 | export default is; 21 | -------------------------------------------------------------------------------- /packages/shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "shared", 4 | "version": "0.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /scripts/authors: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Generate an AUTHORS file based on the output of git shortlog. It uses ABC 4 | # order, strips out leading spaces and numbers, then filters out specific 5 | # authors. 6 | 7 | git shortlog -se \ 8 | | perl -spe 's/^\s+\d+\s+//' \ 9 | | sed -e '/^CommitSyncScript.*$/d' \ 10 | > AUTHORS 11 | -------------------------------------------------------------------------------- /scripts/bench/.gitignore: -------------------------------------------------------------------------------- 1 | react-dom.production.min.js 2 | react.production.min.js 3 | -------------------------------------------------------------------------------- /scripts/bench/benchmarks/hacker-news/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const {join} = require('path'); 4 | 5 | async function build(reactPath, asyncCopyTo) { 6 | // copy the UMD bundles 7 | await asyncCopyTo( 8 | join(reactPath, 'build', 'dist', 'react.production.min.js'), 9 | join(__dirname, 'react.production.min.js') 10 | ); 11 | await asyncCopyTo( 12 | join(reactPath, 'build', 'dist', 'react-dom.production.min.js'), 13 | join(__dirname, 'react-dom.production.min.js') 14 | ); 15 | } 16 | 17 | module.exports = build; 18 | -------------------------------------------------------------------------------- /scripts/bench/benchmarks/hacker-news/grayarrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/scripts/bench/benchmarks/hacker-news/grayarrow.gif -------------------------------------------------------------------------------- /scripts/bench/benchmarks/hacker-news/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/scripts/bench/benchmarks/hacker-news/logo.png -------------------------------------------------------------------------------- /scripts/bench/benchmarks/pe-class-components/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const {join} = require('path'); 4 | 5 | async function build(reactPath, asyncCopyTo) { 6 | // copy the UMD bundles 7 | await asyncCopyTo( 8 | join(reactPath, 'build', 'dist', 'react.production.min.js'), 9 | join(__dirname, 'react.production.min.js') 10 | ); 11 | await asyncCopyTo( 12 | join(reactPath, 'build', 'dist', 'react-dom.production.min.js'), 13 | join(__dirname, 'react-dom.production.min.js') 14 | ); 15 | } 16 | 17 | module.exports = build; 18 | -------------------------------------------------------------------------------- /scripts/bench/benchmarks/pe-functional-components/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const {join} = require('path'); 4 | 5 | async function build(reactPath, asyncCopyTo) { 6 | // copy the UMD bundles 7 | await asyncCopyTo( 8 | join(reactPath, 'build', 'dist', 'react.production.min.js'), 9 | join(__dirname, 'react.production.min.js') 10 | ); 11 | await asyncCopyTo( 12 | join(reactPath, 'build', 'dist', 'react-dom.production.min.js'), 13 | join(__dirname, 'react-dom.production.min.js') 14 | ); 15 | } 16 | 17 | module.exports = build; 18 | -------------------------------------------------------------------------------- /scripts/bench/benchmarks/pe-no-components/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const {join} = require('path'); 4 | 5 | async function build(reactPath, asyncCopyTo) { 6 | // copy the UMD bundles 7 | await asyncCopyTo( 8 | join(reactPath, 'build', 'dist', 'react.production.min.js'), 9 | join(__dirname, 'react.production.min.js') 10 | ); 11 | await asyncCopyTo( 12 | join(reactPath, 'build', 'dist', 'react-dom.production.min.js'), 13 | join(__dirname, 'react-dom.production.min.js') 14 | ); 15 | } 16 | 17 | module.exports = build; 18 | -------------------------------------------------------------------------------- /scripts/bench/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-benchmark", 3 | "version": "0.0.1", 4 | "main": "runner.js", 5 | "scripts": { 6 | "start": "node runner.js" 7 | }, 8 | "dependencies": { 9 | "chalk": "^2.1.0", 10 | "chrome-launcher": "^0.10.5", 11 | "cli-table": "^0.3.1", 12 | "http-server": "^0.10.0", 13 | "http2": "^3.3.6", 14 | "lighthouse": "^3.2.1", 15 | "mime": "^1.3.6", 16 | "minimist": "^1.2.0", 17 | "ncp": "^2.0.0", 18 | "nodegit": "^0.18.3", 19 | "rimraf": "^2.6.1", 20 | "stats-analysis": "^2.0.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /scripts/circleci/add_build_info_json.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | node ./scripts/release/ci-add-build-info-json.js 6 | -------------------------------------------------------------------------------- /scripts/circleci/bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | npm run bench -------------------------------------------------------------------------------- /scripts/circleci/check_license.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Make sure we don't introduce accidental references to PATENTS. 6 | EXPECTED='scripts/circleci/check_license.sh' 7 | ACTUAL=$(git grep -l PATENTS) 8 | 9 | if [ "$EXPECTED" != "$ACTUAL" ]; then 10 | echo "PATENTS crept into some new files?" 11 | diff -u <(echo "$EXPECTED") <(echo "$ACTUAL") || true 12 | exit 1 13 | fi 14 | -------------------------------------------------------------------------------- /scripts/circleci/check_modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Make sure we don't introduce accidental @providesModule annotations. 6 | EXPECTED='scripts/rollup/wrappers.js' 7 | ACTUAL=$(git grep -l @providesModule -- './*.js' ':!scripts/rollup/shims/*.js') 8 | 9 | # Colors 10 | red=$'\e[1;31m' 11 | end=$'\e[0m' 12 | 13 | if [ "$EXPECTED" != "$ACTUAL" ]; then 14 | printf "%s\n" "${red}ERROR: @providesModule crept into some new files?${end}" 15 | diff -u <(echo "$EXPECTED") <(echo "$ACTUAL") || true 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /scripts/circleci/pack_and_store_artifact.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Compress build directory into a single tarball for easy download 6 | tar -zcvf ./build.tgz ./build 7 | 8 | # NPM pack all modules to ensure we archive the correct set of files 9 | cd ./build/node_modules 10 | for dir in ./* ; do 11 | npm pack "$dir" 12 | done 13 | 14 | # Compress packed modules into a single tarball for easy download by the publish script 15 | tar -zcvf ../../node_modules.tgz ./*.tgz 16 | -------------------------------------------------------------------------------- /scripts/circleci/set_up_github_keys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -n "$GITHUB_TOKEN" ]; then 6 | 7 | GH_PAGES_DIR=$(pwd)/../react-gh-pages 8 | echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc 9 | git config --global user.name "Circle CI" 10 | git config --global user.email "circle@reactjs.org" 11 | 12 | fi 13 | -------------------------------------------------------------------------------- /scripts/circleci/test_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | yarn test --coverage --maxWorkers=2 6 | if [ -z "$CI_PULL_REQUEST" ]; then 7 | ./node_modules/.bin/coveralls < ./coverage/lcov.info 8 | fi 9 | 10 | # TODO: should we also track prod code coverage somehow? 11 | # yarn test-prod --coverage 12 | -------------------------------------------------------------------------------- /scripts/circleci/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 | -------------------------------------------------------------------------------- /scripts/circleci/update_package_versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | node ./scripts/release/ci-update-package-versions.js 6 | -------------------------------------------------------------------------------- /scripts/error-codes/Types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 10 | 11 | /*:: export type ErrorMap = { [id: string]: string; }; */ 12 | 13 | -------------------------------------------------------------------------------- /scripts/eslint-rules/README.md: -------------------------------------------------------------------------------- 1 | # Custom ESLint Rules 2 | 3 | This is a dummy npm package that allows us to treat it as an `eslint-plugin`. It's not actually published, nor are the rules here useful for users of React. If you want to lint your React code, try . 4 | 5 | **If you modify this rule, you must re-run `npm install ./eslint-rules` for it to take effect.** 6 | -------------------------------------------------------------------------------- /scripts/eslint-rules/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | rules: { 5 | 'no-primitive-constructors': require('./no-primitive-constructors'), 6 | 'no-to-warn-dev-within-to-throw': require('./no-to-warn-dev-within-to-throw'), 7 | 'warning-and-invariant-args': require('./warning-and-invariant-args'), 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /scripts/eslint-rules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-plugin-react-internal", 3 | "version": "0.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /scripts/jest/config.base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | haste: { 5 | hasteImplModulePath: require.resolve('./noHaste.js'), 6 | }, 7 | modulePathIgnorePatterns: [ 8 | '/scripts/rollup/shims/', 9 | '/scripts/bench/', 10 | ], 11 | transform: { 12 | '.*': require.resolve('./preprocessor.js'), 13 | }, 14 | setupFiles: [require.resolve('./setupEnvironment.js')], 15 | setupTestFrameworkScriptFile: require.resolve('./setupTests.js'), 16 | // Only include files directly in __tests__, not in nested folders. 17 | testRegex: '/__tests__/[^/]*(\\.js|\\.coffee|[^d]\\.ts)$', 18 | moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'], 19 | rootDir: process.cwd(), 20 | roots: ['/packages', '/scripts'], 21 | collectCoverageFrom: ['packages/**/*.js'], 22 | timers: 'fake', 23 | }; 24 | -------------------------------------------------------------------------------- /scripts/jest/config.source-fire.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const baseConfig = require('./config.base'); 4 | 5 | module.exports = Object.assign({}, baseConfig, { 6 | roots: ['/packages/react-dom'], 7 | setupFiles: [ 8 | ...baseConfig.setupFiles, 9 | require.resolve('./setupFire.js'), 10 | require.resolve('./setupHostConfigs.js'), 11 | ], 12 | }); 13 | -------------------------------------------------------------------------------- /scripts/jest/config.source-new-scheduler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const baseConfig = require('./config.base'); 4 | 5 | module.exports = Object.assign({}, baseConfig, { 6 | setupFiles: [ 7 | ...baseConfig.setupFiles, 8 | require.resolve('./setupNewScheduler.js'), 9 | require.resolve('./setupHostConfigs.js'), 10 | ], 11 | }); 12 | -------------------------------------------------------------------------------- /scripts/jest/config.source-persistent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const baseConfig = require('./config.base'); 4 | 5 | module.exports = Object.assign({}, baseConfig, { 6 | modulePathIgnorePatterns: [ 7 | 'ReactIncrementalPerf', 8 | 'ReactIncrementalUpdatesMinimalism', 9 | 'ReactIncrementalTriangle', 10 | 'ReactIncrementalReflection', 11 | 'forwardRef', 12 | ], 13 | setupFiles: [ 14 | ...baseConfig.setupFiles, 15 | require.resolve('./setupTests.persistent.js'), 16 | require.resolve('./setupHostConfigs.js'), 17 | ], 18 | }); 19 | -------------------------------------------------------------------------------- /scripts/jest/config.source.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const baseConfig = require('./config.base'); 4 | 5 | module.exports = Object.assign({}, baseConfig, { 6 | setupFiles: [ 7 | ...baseConfig.setupFiles, 8 | require.resolve('./setupHostConfigs.js'), 9 | ], 10 | }); 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /scripts/jest/noHaste.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | getHasteName() { 5 | // We never want Haste. 6 | return null; 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /scripts/jest/setupEnvironment.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const NODE_ENV = process.env.NODE_ENV; 4 | if (NODE_ENV !== 'development' && NODE_ENV !== 'production') { 5 | throw new Error('NODE_ENV must either be set to development or production.'); 6 | } 7 | global.__DEV__ = NODE_ENV === 'development'; 8 | global.__PROFILE__ = NODE_ENV === 'development'; 9 | global.__UMD__ = false; 10 | 11 | if (typeof window !== 'undefined') { 12 | global.requestAnimationFrame = function(callback) { 13 | setTimeout(callback); 14 | }; 15 | 16 | global.requestIdleCallback = function(callback) { 17 | return setTimeout(() => { 18 | callback({ 19 | timeRemaining() { 20 | return Infinity; 21 | }, 22 | }); 23 | }); 24 | }; 25 | 26 | global.cancelIdleCallback = function(callbackID) { 27 | clearTimeout(callbackID); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /scripts/jest/setupFire.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | jest.mock('react-dom', () => require.requireActual('react-dom/unstable-fire')); 4 | 5 | jest.mock('shared/ReactFeatureFlags', () => { 6 | const ReactFeatureFlags = require.requireActual('shared/ReactFeatureFlags'); 7 | ReactFeatureFlags.disableInputAttributeSyncing = true; 8 | return ReactFeatureFlags; 9 | }); 10 | -------------------------------------------------------------------------------- /scripts/jest/setupNewScheduler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | jest.mock('shared/ReactFeatureFlags', () => { 4 | const ReactFeatureFlags = require.requireActual('shared/ReactFeatureFlags'); 5 | ReactFeatureFlags.enableNewScheduler = true; 6 | return ReactFeatureFlags; 7 | }); 8 | -------------------------------------------------------------------------------- /scripts/jest/setupTests.build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | jest.mock('scheduler', () => require.requireActual('scheduler/unstable_mock')); 4 | jest.mock('scheduler/src/SchedulerHostConfig', () => 5 | require.requireActual('scheduler/src/forks/SchedulerHostConfig.mock.js') 6 | ); 7 | -------------------------------------------------------------------------------- /scripts/jest/setupTests.persistent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | jest.mock('react-noop-renderer', () => 4 | require.requireActual('react-noop-renderer/persistent') 5 | ); 6 | 7 | global.__PERSISTENT__ = true; 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /scripts/perf-counters/README.md: -------------------------------------------------------------------------------- 1 | # perf-counters 2 | 3 | Lightweight bindings to Linux perf event counters. 4 | 5 | ``` 6 | $ node 7 | > var PerfCounters = require('perf-counters'); 8 | > PerfCounters.init(); 9 | > var start = PerfCounters.getCounters(); console.log('test'); var end = PerfCounters.getCounters(); 10 | test 11 | > start 12 | { instructions: 1382, loads: 421, stores: 309 } 13 | > end 14 | { instructions: 647633, loads: 195771, stores: 133246 } 15 | > 16 | ``` 17 | -------------------------------------------------------------------------------- /scripts/perf-counters/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { 4 | "target_name": "perfcounters", 5 | "sources": [ 6 | "src/hardware-counter.cpp", 7 | "src/perf-counters.cpp", 8 | "src/thread-local.cpp", 9 | ], 10 | "cflags": [ 11 | "-Wno-sign-compare", 12 | ], 13 | }, 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /scripts/perf-counters/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('bindings')('perfcounters'); 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /scripts/release/.gitignore: -------------------------------------------------------------------------------- 1 | .progress-estimator -------------------------------------------------------------------------------- /scripts/release/create-canary-commands/build-artifacts.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const {exec} = require('child-process-promise'); 6 | const {join} = require('path'); 7 | const {logPromise} = require('../utils'); 8 | 9 | const run = async ({cwd, dry, tempDirectory}) => { 10 | const defaultOptions = { 11 | cwd: tempDirectory, 12 | }; 13 | 14 | await exec('yarn install', defaultOptions); 15 | await exec('yarn build -- --extract-errors', defaultOptions); 16 | 17 | const tempNodeModulesPath = join(tempDirectory, 'build', 'node_modules'); 18 | const buildPath = join(cwd, 'build'); 19 | 20 | await exec(`cp -r ${tempNodeModulesPath} ${buildPath}`); 21 | }; 22 | 23 | module.exports = async params => { 24 | return logPromise(run(params), 'Building artifacts', 420000); 25 | }; 26 | -------------------------------------------------------------------------------- /scripts/release/create-canary-commands/confirm-automated-testing.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const clear = require('clear'); 6 | const {confirm} = require('../utils'); 7 | const theme = require('../theme'); 8 | 9 | const run = async () => { 10 | clear(); 11 | 12 | console.log( 13 | theme.caution( 14 | 'This script does not run any automated tests.' + 15 | 'You should run them manually before creating a canary release.' 16 | ) 17 | ); 18 | 19 | await confirm('Do you want to proceed?'); 20 | 21 | clear(); 22 | }; 23 | 24 | module.exports = run; 25 | -------------------------------------------------------------------------------- /scripts/release/create-canary-commands/update-version-numbers.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const {logPromise, updateVersionsForCanary} = require('../utils'); 6 | const theme = require('../theme'); 7 | 8 | module.exports = async ({reactVersion, tempDirectory, version}) => { 9 | return logPromise( 10 | updateVersionsForCanary(tempDirectory, reactVersion, version), 11 | theme`Updating version numbers ({version ${version}})` 12 | ); 13 | }; 14 | -------------------------------------------------------------------------------- /scripts/release/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-release-script", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": {}, 6 | "license": "MIT", 7 | "dependencies": { 8 | "chalk": "^2.1.0", 9 | "child-process-promise": "^2.2.1", 10 | "clear": "^0.1.0", 11 | "cli-spinners": "^1.1.0", 12 | "command-line-args": "^4.0.7", 13 | "command-line-usage": "^4.0.1", 14 | "diff": "^3.5.0", 15 | "folder-hash": "^2.1.2", 16 | "fs-extra": "^4.0.2", 17 | "log-update": "^2.1.0", 18 | "progress-estimator": "^0.2.1", 19 | "prompt-promise": "^1.0.3", 20 | "puppeteer": "^1.11.0", 21 | "pushstate-server": "^3.0.1", 22 | "request-promise-json": "^1.0.4", 23 | "semver": "^5.4.1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /scripts/release/prepare-canary-commands/get-latest-master-build-number.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const http = require('request-promise-json'); 6 | const {logPromise} = require('../utils'); 7 | 8 | const run = async () => { 9 | // https://circleci.com/docs/api/#recent-builds-for-a-project-branch 10 | const metadataURL = `https://circleci.com/api/v1.1/project/github/facebook/react/tree/master`; 11 | const metadata = await http.get(metadataURL, true); 12 | const build = metadata.find( 13 | entry => entry.branch === 'master' && entry.status === 'success' 14 | ).build_num; 15 | 16 | return build; 17 | }; 18 | 19 | module.exports = async params => { 20 | return logPromise( 21 | run(params), 22 | 'Determining latest Circle CI for the master branch' 23 | ); 24 | }; 25 | -------------------------------------------------------------------------------- /scripts/release/prepare-canary-commands/parse-params.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const commandLineArgs = require('command-line-args'); 6 | 7 | const paramDefinitions = [ 8 | { 9 | name: 'build', 10 | type: Number, 11 | description: 12 | 'Circle CI build identifier (e.g. https://circleci.com/gh/facebook/react/)', 13 | }, 14 | { 15 | name: 'skipTests', 16 | type: Boolean, 17 | description: 'Skip automated fixture tests.', 18 | defaultValue: false, 19 | }, 20 | ]; 21 | 22 | module.exports = () => { 23 | const params = commandLineArgs(paramDefinitions); 24 | 25 | return params; 26 | }; 27 | -------------------------------------------------------------------------------- /scripts/release/prepare-stable-commands/get-latest-canary-version.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const {execRead, logPromise} = require('../utils'); 6 | 7 | const run = async () => { 8 | const version = await execRead('npm info react@canary version'); 9 | 10 | return version; 11 | }; 12 | 13 | module.exports = async params => { 14 | return logPromise(run(params), 'Determining latest canary release version'); 15 | }; 16 | -------------------------------------------------------------------------------- /scripts/release/prepare-stable-commands/parse-params.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const commandLineArgs = require('command-line-args'); 6 | 7 | const paramDefinitions = [ 8 | { 9 | name: 'local', 10 | type: Boolean, 11 | description: 12 | 'Skip NPM and use the build already present in "build/node_modules".', 13 | defaultValue: false, 14 | }, 15 | { 16 | name: 'skipTests', 17 | type: Boolean, 18 | description: 'Skip automated fixture tests.', 19 | defaultValue: false, 20 | }, 21 | { 22 | name: 'version', 23 | type: String, 24 | description: 'Version of published canary release (e.g. 0.0.0-ddaf2b07c)', 25 | }, 26 | ]; 27 | 28 | module.exports = () => { 29 | const params = commandLineArgs(paramDefinitions); 30 | 31 | return params; 32 | }; 33 | -------------------------------------------------------------------------------- /scripts/release/publish-commands/prompt-for-otp.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const prompt = require('prompt-promise'); 6 | const theme = require('../theme'); 7 | 8 | const run = async () => { 9 | while (true) { 10 | const otp = await prompt('NPM 2-factor auth code: '); 11 | prompt.done(); 12 | 13 | if (otp) { 14 | return otp; 15 | } else { 16 | console.log(); 17 | console.log(theme.error`Two-factor auth is required to publish.`); 18 | // (Ask again.) 19 | } 20 | } 21 | }; 22 | 23 | module.exports = run; 24 | -------------------------------------------------------------------------------- /scripts/release/publish-commands/validate-tags.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const {readJson} = require('fs-extra'); 6 | const {join} = require('path'); 7 | const theme = require('../theme'); 8 | 9 | const run = async ({cwd, packages, tags}) => { 10 | // Prevent a canary release from ever being published as @latest 11 | const packageJSONPath = join( 12 | cwd, 13 | 'build', 14 | 'node_modules', 15 | 'react', 16 | 'package.json' 17 | ); 18 | const {version} = await readJson(packageJSONPath); 19 | if (version.indexOf('0.0.0') === 0) { 20 | if (tags.includes('latest')) { 21 | console.log( 22 | theme`{error Canary release} {version ${version}} {error cannot be tagged as} {tag latest}` 23 | ); 24 | process.exit(1); 25 | } 26 | } 27 | }; 28 | 29 | module.exports = run; 30 | -------------------------------------------------------------------------------- /scripts/rollup/plugins/sizes-plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 8 | 9 | const gzip = require('gzip-size'); 10 | 11 | module.exports = function sizes(options) { 12 | return { 13 | name: 'scripts/rollup/plugins/sizes-plugin', 14 | ongenerate(bundle, obj) { 15 | const size = Buffer.byteLength(obj.code); 16 | const gzipSize = gzip.sync(obj.code); 17 | 18 | options.getSize(size, gzipSize); 19 | }, 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /scripts/rollup/shims/facebook-www/ReactBrowserEventEmitter_DO_NOT_USE.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const { 11 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 12 | } = require('ReactDOM-fb'); 13 | 14 | module.exports = 15 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactBrowserEventEmitter; 16 | -------------------------------------------------------------------------------- /scripts/rollup/shims/facebook-www/ReactDOMComponentTree_DO_NOT_USE.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const { 11 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 12 | } = require('ReactDOM-fb'); 13 | 14 | module.exports = 15 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree; 16 | -------------------------------------------------------------------------------- /scripts/rollup/shims/facebook-www/ReactInstanceMap_DO_NOT_USE.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const { 11 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 12 | } = require('ReactDOM-fb'); 13 | 14 | module.exports = 15 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactInstanceMap; 16 | -------------------------------------------------------------------------------- /scripts/rollup/shims/facebook-www/findDOMNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @format 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const {findDOMNode} = require('ReactDOM-fb'); 14 | 15 | module.exports = findDOMNode; 16 | -------------------------------------------------------------------------------- /scripts/rollup/shims/facebook-www/renderSubtreeIntoContainer_DO_NOT_USE.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const ReactDOM = require('ReactDOM-fb'); 11 | 12 | module.exports = ReactDOM.unstable_renderSubtreeIntoContainer; 13 | -------------------------------------------------------------------------------- /scripts/rollup/shims/react-native-fb/ReactFeatureFlags.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const ReactFeatureFlags = { 14 | debugRenderPhaseSideEffects: false, 15 | }; 16 | 17 | module.exports = ReactFeatureFlags; 18 | -------------------------------------------------------------------------------- /scripts/rollup/shims/react-native/NativeMethodsMixin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const { 14 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 15 | } = require('ReactNative'); 16 | 17 | import type {NativeMethodsMixinType} from 'ReactNativeTypes'; 18 | 19 | const {NativeMethodsMixin} = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 20 | 21 | module.exports = ((NativeMethodsMixin: any): $Exact); 22 | -------------------------------------------------------------------------------- /scripts/rollup/shims/react-native/ReactFabric.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const BatchedBridge = require('BatchedBridge'); 14 | 15 | // TODO @sema: Adjust types 16 | import type {ReactNativeType} from 'ReactNativeTypes'; 17 | 18 | let ReactFabric; 19 | 20 | if (__DEV__) { 21 | ReactFabric = require('ReactFabric-dev'); 22 | } else { 23 | ReactFabric = require('ReactFabric-prod'); 24 | } 25 | 26 | BatchedBridge.registerCallableModule('ReactFabric', ReactFabric); 27 | 28 | module.exports = (ReactFabric: ReactNativeType); 29 | -------------------------------------------------------------------------------- /scripts/rollup/shims/react-native/ReactNative.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | import type {ReactNativeType} from 'ReactNativeTypes'; 14 | 15 | let ReactNative; 16 | 17 | if (__DEV__) { 18 | ReactNative = require('ReactNativeRenderer-dev'); 19 | } else { 20 | ReactNative = require('ReactNativeRenderer-prod'); 21 | } 22 | 23 | module.exports = (ReactNative: ReactNativeType); 24 | -------------------------------------------------------------------------------- /scripts/rollup/validate/eslintignore: -------------------------------------------------------------------------------- 1 | # Don't validate noop renderer bundle. 2 | # Unlike others, it currently uses ES6 syntax (generators). 3 | # We also don't use or publish it. 4 | **/react-noop-renderer/** 5 | JestReact-prod.js 6 | JestReact-dev.js 7 | **/jest-react/** -------------------------------------------------------------------------------- /scripts/rollup/validate/eslintrc.cjs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | env: { 5 | commonjs: true, 6 | browser: true, 7 | }, 8 | globals: { 9 | // ES 6 10 | Map: true, 11 | Set: true, 12 | Proxy: true, 13 | Symbol: true, 14 | WeakMap: true, 15 | WeakSet: true, 16 | Uint16Array: true, 17 | // Vendor specific 18 | MSApp: true, 19 | __REACT_DEVTOOLS_GLOBAL_HOOK__: true, 20 | // CommonJS / Node 21 | process: true, 22 | setImmediate: true, 23 | Buffer: true, 24 | }, 25 | parserOptions: { 26 | ecmaVersion: 5, 27 | sourceType: 'script', 28 | }, 29 | rules: { 30 | 'no-undef': 'error', 31 | 'no-shadow-restricted-names': 'error', 32 | }, 33 | }; 34 | -------------------------------------------------------------------------------- /scripts/rollup/validate/eslintrc.fb.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | env: { 5 | commonjs: true, 6 | browser: true, 7 | }, 8 | globals: { 9 | // ES6 10 | Map: true, 11 | Set: true, 12 | Symbol: true, 13 | Proxy: true, 14 | WeakMap: true, 15 | WeakSet: true, 16 | Uint16Array: true, 17 | // Vendor specific 18 | MSApp: true, 19 | __REACT_DEVTOOLS_GLOBAL_HOOK__: true, 20 | // FB 21 | __DEV__: true, 22 | // Node.js Server Rendering 23 | setImmediate: true, 24 | Buffer: true, 25 | }, 26 | parserOptions: { 27 | ecmaVersion: 5, 28 | sourceType: 'script', 29 | }, 30 | rules: { 31 | 'no-undef': 'error', 32 | 'no-shadow-restricted-names': 'error', 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /scripts/rollup/validate/eslintrc.rn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | env: { 5 | commonjs: true, 6 | browser: true, 7 | }, 8 | globals: { 9 | // ES6 10 | Map: true, 11 | Set: true, 12 | Symbol: true, 13 | Proxy: true, 14 | WeakMap: true, 15 | WeakSet: true, 16 | // Vendor specific 17 | MSApp: true, 18 | __REACT_DEVTOOLS_GLOBAL_HOOK__: true, 19 | // FB 20 | __DEV__: true, 21 | }, 22 | parserOptions: { 23 | ecmaVersion: 5, 24 | sourceType: 'script', 25 | }, 26 | rules: { 27 | 'no-undef': 'error', 28 | 'no-shadow-restricted-names': 'error', 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /scripts/rollup/validate/eslintrc.umd.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | env: { 5 | browser: true, 6 | }, 7 | globals: { 8 | // ES6 9 | Map: true, 10 | Set: true, 11 | Symbol: true, 12 | Proxy: true, 13 | WeakMap: true, 14 | WeakSet: true, 15 | Uint16Array: true, 16 | // Vendor specific 17 | MSApp: true, 18 | __REACT_DEVTOOLS_GLOBAL_HOOK__: true, 19 | // UMD wrapper code 20 | // TODO: this is too permissive. 21 | // Ideally we should only allow these *inside* the UMD wrapper. 22 | exports: true, 23 | module: true, 24 | define: true, 25 | require: true, 26 | global: true, 27 | }, 28 | parserOptions: { 29 | ecmaVersion: 5, 30 | sourceType: 'script', 31 | }, 32 | rules: { 33 | 'no-undef': 'error', 34 | 'no-shadow-restricted-names': 'error', 35 | }, 36 | }; 37 | -------------------------------------------------------------------------------- /scripts/shared/evalToString.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 10 | 11 | function evalToString(ast /* : Object */) /* : string */ { 12 | switch (ast.type) { 13 | case 'StringLiteral': 14 | return ast.value; 15 | case 'BinaryExpression': // `+` 16 | if (ast.operator !== '+') { 17 | throw new Error('Unsupported binary operator ' + ast.operator); 18 | } 19 | return evalToString(ast.left) + evalToString(ast.right); 20 | default: 21 | throw new Error('Unsupported type ' + ast.type); 22 | } 23 | } 24 | 25 | module.exports = evalToString; 26 | -------------------------------------------------------------------------------- /scripts/shared/pathsByLanguageVersion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | 'use strict'; 8 | 9 | // Files that are transformed and can use ES6/Flow/JSX. 10 | const esNextPaths = [ 11 | // Internal forwarding modules 12 | 'packages/*/*.js', 13 | // Source files 14 | 'packages/*/src/**/*.js', 15 | 'packages/events/**/*.js', 16 | 'packages/shared/**/*.js', 17 | // Shims and Flow environment 18 | 'scripts/flow/*.js', 19 | 'scripts/rollup/shims/**/*.js', 20 | ]; 21 | 22 | // Files that we distribute on npm that should be ES5-only. 23 | const es5Paths = ['packages/*/npm/**/*.js']; 24 | 25 | module.exports = { 26 | esNextPaths, 27 | es5Paths, 28 | }; 29 | -------------------------------------------------------------------------------- /scripts/tasks/eslint.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const runESLint = require('../eslint'); 11 | 12 | console.log('Linting all files...'); 13 | // https://circleci.com/docs/2.0/env-vars/#circleci-environment-variable-descriptions 14 | if (!process.env.CI) { 15 | console.log('Hint: run `yarn linc` to only lint changed files.'); 16 | } 17 | 18 | if (runESLint({onlyChanged: false})) { 19 | console.log('Lint passed.'); 20 | } else { 21 | console.log('Lint failed.'); 22 | process.exit(1); 23 | } 24 | -------------------------------------------------------------------------------- /scripts/tasks/flow-ci.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | process.on('unhandledRejection', err => { 11 | throw err; 12 | }); 13 | 14 | const runFlow = require('../flow/runFlow'); 15 | const inlinedHostConfigs = require('../shared/inlinedHostConfigs'); 16 | 17 | async function checkAll() { 18 | // eslint-disable-next-line no-for-of-loops/no-for-of-loops 19 | for (let rendererInfo of inlinedHostConfigs) { 20 | if (rendererInfo.isFlowTyped) { 21 | await runFlow(rendererInfo.shortName, ['check']); 22 | console.log(); 23 | } 24 | } 25 | } 26 | 27 | checkAll(); 28 | -------------------------------------------------------------------------------- /scripts/tasks/linc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its 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 | const runESLint = require('../eslint'); 11 | 12 | console.log('Linting changed files...'); 13 | 14 | if (runESLint({onlyChanged: true})) { 15 | console.log('Lint passed for changed files.'); 16 | } else { 17 | console.log('Lint failed for changed files.'); 18 | process.exit(1); 19 | } 20 | -------------------------------------------------------------------------------- /src/react/component.js: -------------------------------------------------------------------------------- 1 | import { renderComponent } from "../react-dom/render"; 2 | import enqueueSetState from './enqueueSetState' 3 | 4 | 5 | class Component { 6 | constructor(props = {}) { 7 | this.isReactComponent = true; 8 | 9 | this.state = {}; 10 | this.props = props; // props从外部传进来 11 | } 12 | 13 | // 同步setState 14 | setStateSync(stateChange) { 15 | Object.assign(this.state, stateChange); 16 | renderComponent(this); 17 | } 18 | 19 | // 异步setState 20 | setState(stateChange) { 21 | enqueueSetState(stateChange, this); 22 | } 23 | } 24 | 25 | export default Component; 26 | -------------------------------------------------------------------------------- /src/react/createElement.js: -------------------------------------------------------------------------------- 1 | export default function createElement(tag, attrs, ...children) { 2 | return { 3 | tag, 4 | attrs, 5 | children 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /src/react/index.js: -------------------------------------------------------------------------------- 1 | import Component from './component.js' 2 | import createElement from './createElement.js' 3 | 4 | export default { 5 | Component, 6 | createElement 7 | } 8 | -------------------------------------------------------------------------------- /学习笔记/React16源码解析hooks原理-待看.md: -------------------------------------------------------------------------------- 1 | - https://juejin.im/post/5cc809d2f265da036c579620 2 | - https://juejin.im/post/5dc6e1b35188251ab9183c7d 3 | - https://www.jianshu.com/p/fc31704ad0ee?from=timeline 4 | - https://zhuanlan.zhihu.com/p/67509302 -------------------------------------------------------------------------------- /学习笔记/img/Child避免从末尾插入头部.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/Child避免从末尾插入头部.png -------------------------------------------------------------------------------- /学习笔记/img/FiberReconciler的执行阶段的生命周期调用.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/FiberReconciler的执行阶段的生命周期调用.png -------------------------------------------------------------------------------- /学习笔记/img/FiberTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/FiberTree.png -------------------------------------------------------------------------------- /学习笔记/img/Fiber与浏览器任务切换.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/Fiber与浏览器任务切换.png -------------------------------------------------------------------------------- /学习笔记/img/KeyDiff1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/KeyDiff1.png -------------------------------------------------------------------------------- /学习笔记/img/KeyDiffDelOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/KeyDiffDelOne.png -------------------------------------------------------------------------------- /学习笔记/img/React15diffKey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React15diffKey.png -------------------------------------------------------------------------------- /学习笔记/img/React15diffVdomVdom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React15diffVdomVdom.png -------------------------------------------------------------------------------- /学习笔记/img/React15diff删除节点.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React15diff删除节点.png -------------------------------------------------------------------------------- /学习笔记/img/React15diff同层比较策略.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React15diff同层比较策略.png -------------------------------------------------------------------------------- /学习笔记/img/React15diff策略.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React15diff策略.png -------------------------------------------------------------------------------- /学习笔记/img/React双向缓存首屏.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React双向缓存首屏.png -------------------------------------------------------------------------------- /学习笔记/img/React双向缓存首屏渲染完成.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React双向缓存首屏渲染完成.png -------------------------------------------------------------------------------- /学习笔记/img/React双缓存完成更新.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React双缓存完成更新.png -------------------------------------------------------------------------------- /学习笔记/img/React双缓存技术.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React双缓存技术.png -------------------------------------------------------------------------------- /学习笔记/img/React调度流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/React调度流程图.png -------------------------------------------------------------------------------- /学习笔记/img/VTree与FiberTree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/VTree与FiberTree.jpg -------------------------------------------------------------------------------- /学习笔记/img/createUpdate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/createUpdate.png -------------------------------------------------------------------------------- /学习笔记/img/ensureRootIsScheduled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/ensureRootIsScheduled.png -------------------------------------------------------------------------------- /学习笔记/img/newChild单个但是ordChild多个.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/newChild单个但是ordChild多个.png -------------------------------------------------------------------------------- /学习笔记/img/reactRootContainer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/reactRootContainer.png -------------------------------------------------------------------------------- /学习笔记/img/render流程.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/render流程.png -------------------------------------------------------------------------------- /学习笔记/img/scheduleWork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/scheduleWork.png -------------------------------------------------------------------------------- /学习笔记/img/任务划分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/任务划分.png -------------------------------------------------------------------------------- /学习笔记/img/分片.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/分片.png -------------------------------------------------------------------------------- /学习笔记/img/完整流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/完整流程图.png -------------------------------------------------------------------------------- /学习笔记/img/帧任务.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/帧任务.png -------------------------------------------------------------------------------- /学习笔记/img/帧任务2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/帧任务2.png -------------------------------------------------------------------------------- /学习笔记/img/并发渲染.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/并发渲染.png -------------------------------------------------------------------------------- /学习笔记/img/执行帧.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/执行帧.png -------------------------------------------------------------------------------- /学习笔记/img/生命周期中的setState.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/生命周期中的setState.png -------------------------------------------------------------------------------- /学习笔记/img/调度.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/调度.png -------------------------------------------------------------------------------- /学习笔记/img/链式遍历.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jianjiachenghub/react-deeplearn/5dc69df9f37e3f889c9fe17754be8fb0eb8b15a1/学习笔记/img/链式遍历.png --------------------------------------------------------------------------------