├── .babelrc ├── .gitignore ├── README.md ├── my-react └── react.js ├── package.json ├── packages ├── create-subscription │ ├── README.md │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── __tests__ │ │ └── createSubscription-test.js │ │ └── createSubscription.js ├── dom-event-testing-library │ ├── README.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── index-test.internal.js.snap │ │ └── index-test.internal.js │ ├── constants.js │ ├── domEnvironment.js │ ├── domEventSequences.js │ ├── domEvents.js │ ├── index.js │ ├── package.json │ ├── testHelpers.js │ └── touchStore.js ├── eslint-plugin-react-hooks │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── ESLintRuleExhaustiveDeps-test.js │ │ └── ESLintRulesOfHooks-test.js │ ├── index.js │ ├── npm │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ExhaustiveDeps.js │ │ ├── RulesOfHooks.js │ │ └── index.js ├── 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 │ │ ├── ReactCacheOld.js │ │ └── __tests__ │ │ └── ReactCacheOld-test.internal.js ├── react-client │ ├── README.md │ ├── flight.js │ ├── npm │ │ └── flight.js │ ├── package.json │ └── src │ │ ├── ReactFlightClient.js │ │ ├── ReactFlightClientHostConfig.js │ │ ├── ReactFlightClientHostConfigBrowser.js │ │ ├── ReactFlightClientHostConfigNoStream.js │ │ ├── ReactFlightClientHostConfigStream.js │ │ ├── ReactFlightClientStream.js │ │ ├── __tests__ │ │ └── ReactFlight-test.js │ │ └── forks │ │ ├── ReactFlightClientHostConfig.custom.js │ │ ├── ReactFlightClientHostConfig.dom-browser.js │ │ ├── ReactFlightClientHostConfig.dom-relay.js │ │ └── ReactFlightClientHostConfig.dom.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-devtools-core │ ├── README.md │ ├── backend.js │ ├── package.json │ ├── src │ │ ├── backend.js │ │ ├── editor.js │ │ └── standalone.js │ ├── standalone.js │ ├── webpack.backend.js │ └── webpack.standalone.js ├── react-devtools-extensions │ ├── .circleci │ │ └── config.yml │ ├── README.md │ ├── build.js │ ├── chrome │ │ ├── README.md │ │ ├── build.js │ │ ├── deploy.js │ │ ├── manifest.json │ │ ├── now.json │ │ └── test.js │ ├── deploy.chrome.html │ ├── deploy.edge.html │ ├── deploy.firefox.html │ ├── deploy.html │ ├── deploy.js │ ├── edge │ │ ├── README.md │ │ ├── build.js │ │ ├── deploy.js │ │ ├── manifest.json │ │ ├── now.json │ │ └── test.js │ ├── firefox │ │ ├── README.md │ │ ├── build.js │ │ ├── deploy.js │ │ ├── manifest.json │ │ ├── now.json │ │ └── test.js │ ├── flow-typed │ │ ├── jest.js │ │ └── npm │ │ │ └── react-test-renderer_v16.x.x.js │ ├── icons │ │ ├── 128-deadcode.png │ │ ├── 128-development.png │ │ ├── 128-disabled.png │ │ ├── 128-outdated.png │ │ ├── 128-production.png │ │ ├── 128-unminified.png │ │ ├── 16-deadcode.png │ │ ├── 16-development.png │ │ ├── 16-disabled.png │ │ ├── 16-outdated.png │ │ ├── 16-production.png │ │ ├── 16-unminified.png │ │ ├── 32-deadcode.png │ │ ├── 32-development.png │ │ ├── 32-disabled.png │ │ ├── 32-outdated.png │ │ ├── 32-production.png │ │ ├── 32-unminified.png │ │ ├── 48-deadcode.png │ │ ├── 48-development.png │ │ ├── 48-disabled.png │ │ ├── 48-outdated.png │ │ ├── 48-production.png │ │ ├── 48-unminified.png │ │ ├── deadcode.svg │ │ ├── development.svg │ │ ├── disabled.svg │ │ ├── outdated.svg │ │ └── production.svg │ ├── main.html │ ├── package.json │ ├── panel.html │ ├── popups │ │ ├── deadcode.html │ │ ├── development.html │ │ ├── disabled.html │ │ ├── outdated.html │ │ ├── production.html │ │ ├── shared.js │ │ └── unminified.html │ ├── src │ │ ├── backend.js │ │ ├── background.js │ │ ├── contentScript.js │ │ ├── injectGlobalHook.js │ │ ├── main.js │ │ ├── panel.js │ │ ├── renderer.js │ │ └── utils.js │ ├── utils.js │ ├── webpack.backend.js │ └── webpack.config.js ├── react-devtools-inline │ ├── README.md │ ├── backend.js │ ├── frontend.js │ ├── package.json │ ├── src │ │ ├── backend.js │ │ ├── constants.js │ │ └── frontend.js │ └── webpack.config.js ├── react-devtools-scheduling-profiler │ ├── README.md │ ├── buildUtils.js │ ├── package.json │ ├── src │ │ ├── App.css │ │ ├── App.js │ │ ├── CanvasPage.css │ │ ├── CanvasPage.js │ │ ├── EventTooltip.css │ │ ├── EventTooltip.js │ │ ├── ImportButton.css │ │ ├── ImportButton.js │ │ ├── SchedulingProfiler.css │ │ ├── SchedulingProfiler.js │ │ ├── SchedulingProfilerFeatureFlags.js │ │ ├── assets │ │ │ ├── logo.svg │ │ │ ├── profilerBrowser.png │ │ │ └── reactlogo.svg │ │ ├── constants.js │ │ ├── content-views │ │ │ ├── FlamechartView.js │ │ │ ├── ReactEventsView.js │ │ │ ├── ReactMeasuresView.js │ │ │ ├── TimeAxisMarkersView.js │ │ │ ├── UserTimingMarksView.js │ │ │ ├── constants.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ ├── __tests__ │ │ │ │ └── colors-test.js │ │ │ │ ├── colors.js │ │ │ │ └── positioning.js │ │ ├── context │ │ │ ├── ContextMenu.css │ │ │ ├── ContextMenu.js │ │ │ ├── ContextMenuItem.css │ │ │ ├── ContextMenuItem.js │ │ │ ├── Contexts.js │ │ │ ├── index.js │ │ │ └── useContextMenu.js │ │ ├── hooks.js │ │ ├── import-worker │ │ │ ├── InvalidProfileError.js │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── preprocessData-test.js.snap │ │ │ │ └── preprocessData-test.js │ │ │ ├── import.worker.js │ │ │ ├── preprocessData.js │ │ │ └── readInputData.js │ │ ├── index.css │ │ ├── index.js │ │ ├── types.js │ │ ├── utils │ │ │ ├── getBatchRange.js │ │ │ └── useSmartTooltip.js │ │ └── view-base │ │ │ ├── ColorView.js │ │ │ ├── HorizontalPanAndZoomView.js │ │ │ ├── ResizableSplitView.js │ │ │ ├── Surface.js │ │ │ ├── VerticalScrollView.js │ │ │ ├── View.js │ │ │ ├── __tests__ │ │ │ └── geometry-test.js │ │ │ ├── constants.js │ │ │ ├── geometry.js │ │ │ ├── index.js │ │ │ ├── layouter.js │ │ │ ├── useCanvasInteraction.js │ │ │ └── utils │ │ │ ├── __tests__ │ │ │ ├── clamp-test.js │ │ │ └── scrollState-test.js │ │ │ ├── clamp.js │ │ │ ├── normalizeWheel.js │ │ │ └── scrollState.js │ ├── vercel.json │ └── webpack.config.js ├── react-devtools-shared │ ├── babel.config.js │ ├── package.json │ └── src │ │ ├── __tests__ │ │ ├── __mocks__ │ │ │ └── cssMock.js │ │ ├── __snapshots__ │ │ │ ├── inspectedElementContext-test.js.snap │ │ │ ├── ownersListContext-test.js.snap │ │ │ ├── profilerContext-test.js.snap │ │ │ ├── profilingCache-test.js.snap │ │ │ ├── profilingCharts-test.js.snap │ │ │ ├── profilingCommitTreeBuilder-test.js.snap │ │ │ ├── store-test.js.snap │ │ │ ├── storeComponentFilters-test.js.snap │ │ │ ├── storeOwners-test.js.snap │ │ │ ├── storeStressSync-test.js.snap │ │ │ └── treeContext-test.js.snap │ │ ├── bridge-test.js │ │ ├── console-test.js │ │ ├── editing-test.js │ │ ├── events-test.js │ │ ├── inspectedElementContext-test.js │ │ ├── inspectedElementSerializer.js │ │ ├── legacy │ │ │ ├── __snapshots__ │ │ │ │ ├── inspectElement-test.js.snap │ │ │ │ └── storeLegacy-v15-test.js.snap │ │ │ ├── editing-test.js │ │ │ ├── inspectElement-test.js │ │ │ └── storeLegacy-v15-test.js │ │ ├── ownersListContext-test.js │ │ ├── profilerContext-test.js │ │ ├── profilerStore-test.js │ │ ├── profilingCache-test.js │ │ ├── profilingCharts-test.js │ │ ├── profilingCommitTreeBuilder-test.js │ │ ├── profilingUtils-test.js │ │ ├── setupEnv.js │ │ ├── setupTests.js │ │ ├── store-test.js │ │ ├── storeComponentFilters-test.js │ │ ├── storeOwners-test.js │ │ ├── storeSerializer.js │ │ ├── storeStressSync-test.js │ │ ├── storeStressTestConcurrent-test.js │ │ ├── treeContext-test.js │ │ ├── useEditableValue-test.js │ │ ├── utils-test.js │ │ └── utils.js │ │ ├── backend │ │ ├── DevToolsComponentStackFrame.js │ │ ├── DevToolsFiberComponentStack.js │ │ ├── NativeStyleEditor │ │ │ ├── resolveBoxStyle.js │ │ │ ├── setupNativeStyleEditor.js │ │ │ └── types.js │ │ ├── ReactSymbols.js │ │ ├── agent.js │ │ ├── console.js │ │ ├── index.js │ │ ├── legacy │ │ │ ├── renderer.js │ │ │ └── utils.js │ │ ├── renderer.js │ │ ├── types.js │ │ ├── utils.js │ │ └── views │ │ │ ├── Highlighter │ │ │ ├── Highlighter.js │ │ │ ├── Overlay.js │ │ │ └── index.js │ │ │ ├── TraceUpdates │ │ │ ├── canvas.js │ │ │ └── index.js │ │ │ └── utils.js │ │ ├── bridge.js │ │ ├── constants.js │ │ ├── devtools │ │ ├── ContextMenu │ │ │ ├── ContextMenu.css │ │ │ ├── ContextMenu.js │ │ │ ├── ContextMenuItem.css │ │ │ ├── ContextMenuItem.js │ │ │ ├── Contexts.js │ │ │ └── useContextMenu.js │ │ ├── ProfilerStore.js │ │ ├── ProfilingCache.js │ │ ├── cache.js │ │ ├── index.js │ │ ├── store.js │ │ ├── utils.js │ │ └── views │ │ │ ├── Button.css │ │ │ ├── Button.js │ │ │ ├── ButtonIcon.css │ │ │ ├── ButtonIcon.js │ │ │ ├── Components │ │ │ ├── Badge.css │ │ │ ├── Badge.js │ │ │ ├── CannotSuspendWarningMessage.js │ │ │ ├── Components.css │ │ │ ├── Components.js │ │ │ ├── EditableName.css │ │ │ ├── EditableName.js │ │ │ ├── EditableValue.css │ │ │ ├── EditableValue.js │ │ │ ├── Element.css │ │ │ ├── Element.js │ │ │ ├── ExpandCollapseToggle.css │ │ │ ├── ExpandCollapseToggle.js │ │ │ ├── HocBadges.css │ │ │ ├── HocBadges.js │ │ │ ├── InspectHostNodesToggle.js │ │ │ ├── InspectedElement.css │ │ │ ├── InspectedElement.js │ │ │ ├── InspectedElementContext.js │ │ │ ├── InspectedElementContextTree.js │ │ │ ├── InspectedElementHooksTree.css │ │ │ ├── InspectedElementHooksTree.js │ │ │ ├── InspectedElementPropsTree.js │ │ │ ├── InspectedElementSharedStyles.css │ │ │ ├── InspectedElementStateTree.js │ │ │ ├── InspectedElementSuspenseToggle.js │ │ │ ├── InspectedElementView.css │ │ │ ├── InspectedElementView.js │ │ │ ├── KeyValue.css │ │ │ ├── KeyValue.js │ │ │ ├── NativeStyleEditor │ │ │ │ ├── AutoSizeInput.css │ │ │ │ ├── AutoSizeInput.js │ │ │ │ ├── LayoutViewer.css │ │ │ │ ├── LayoutViewer.js │ │ │ │ ├── StyleEditor.css │ │ │ │ ├── StyleEditor.js │ │ │ │ ├── context.js │ │ │ │ ├── index.js │ │ │ │ └── types.js │ │ │ ├── NewArrayValue.css │ │ │ ├── NewArrayValue.js │ │ │ ├── NewKeyValue.css │ │ │ ├── NewKeyValue.js │ │ │ ├── OwnersListContext.js │ │ │ ├── OwnersStack.css │ │ │ ├── OwnersStack.js │ │ │ ├── SearchInput.css │ │ │ ├── SearchInput.js │ │ │ ├── SelectedTreeHighlight.css │ │ │ ├── SelectedTreeHighlight.js │ │ │ ├── Tree.css │ │ │ ├── Tree.js │ │ │ ├── TreeContext.js │ │ │ ├── TreeFocusedContext.js │ │ │ ├── ViewElementSourceContext.js │ │ │ ├── types.js │ │ │ └── utils.js │ │ │ ├── DevTools.css │ │ │ ├── DevTools.js │ │ │ ├── ErrorBoundary.css │ │ │ ├── ErrorBoundary.js │ │ │ ├── Icon.css │ │ │ ├── Icon.js │ │ │ ├── ModalDialog.css │ │ │ ├── ModalDialog.js │ │ │ ├── Profiler │ │ │ ├── ChartNode.css │ │ │ ├── ChartNode.js │ │ │ ├── ClearProfilingDataButton.js │ │ │ ├── CommitFlamegraph.css │ │ │ ├── CommitFlamegraph.js │ │ │ ├── CommitFlamegraphListItem.js │ │ │ ├── CommitRanked.css │ │ │ ├── CommitRanked.js │ │ │ ├── CommitRankedListItem.js │ │ │ ├── CommitTreeBuilder.js │ │ │ ├── FlamegraphChartBuilder.js │ │ │ ├── HoveredFiberInfo.css │ │ │ ├── HoveredFiberInfo.js │ │ │ ├── InteractionListItem.css │ │ │ ├── InteractionListItem.js │ │ │ ├── Interactions.css │ │ │ ├── Interactions.js │ │ │ ├── InteractionsChartBuilder.js │ │ │ ├── NoCommitData.css │ │ │ ├── NoCommitData.js │ │ │ ├── NoInteractions.css │ │ │ ├── NoInteractions.js │ │ │ ├── Profiler.css │ │ │ ├── Profiler.js │ │ │ ├── ProfilerContext.js │ │ │ ├── ProfilingImportExportButtons.css │ │ │ ├── ProfilingImportExportButtons.js │ │ │ ├── RankedChartBuilder.js │ │ │ ├── RecordToggle.css │ │ │ ├── RecordToggle.js │ │ │ ├── ReloadAndProfileButton.js │ │ │ ├── RootSelector.css │ │ │ ├── RootSelector.js │ │ │ ├── SidebarCommitInfo.css │ │ │ ├── SidebarCommitInfo.js │ │ │ ├── SidebarInteractions.css │ │ │ ├── SidebarInteractions.js │ │ │ ├── SidebarSelectedFiberInfo.css │ │ │ ├── SidebarSelectedFiberInfo.js │ │ │ ├── SnapshotCommitList.css │ │ │ ├── SnapshotCommitList.js │ │ │ ├── SnapshotCommitListItem.css │ │ │ ├── SnapshotCommitListItem.js │ │ │ ├── SnapshotSelector.css │ │ │ ├── SnapshotSelector.js │ │ │ ├── Tooltip.css │ │ │ ├── Tooltip.js │ │ │ ├── WhatChanged.css │ │ │ ├── WhatChanged.js │ │ │ ├── constants.js │ │ │ ├── types.js │ │ │ └── utils.js │ │ │ ├── ReactLogo.css │ │ │ ├── ReactLogo.js │ │ │ ├── Settings │ │ │ ├── ComponentsSettings.js │ │ │ ├── DebuggingSettings.js │ │ │ ├── GeneralSettings.js │ │ │ ├── ProfilerSettings.js │ │ │ ├── SettingsContext.js │ │ │ ├── SettingsModal.css │ │ │ ├── SettingsModal.js │ │ │ ├── SettingsModalContext.js │ │ │ ├── SettingsModalContextToggle.js │ │ │ └── SettingsShared.css │ │ │ ├── TabBar.css │ │ │ ├── TabBar.js │ │ │ ├── Toggle.css │ │ │ ├── Toggle.js │ │ │ ├── Tooltip.css │ │ │ ├── UnsupportedVersionDialog.css │ │ │ ├── UnsupportedVersionDialog.js │ │ │ ├── WarnIfLegacyBackendDetected.css │ │ │ ├── WarnIfLegacyBackendDetected.js │ │ │ ├── context.js │ │ │ ├── hooks.js │ │ │ ├── portaledContent.js │ │ │ ├── root.css │ │ │ └── utils.js │ │ ├── events.js │ │ ├── hook.js │ │ ├── hydration.js │ │ ├── storage.js │ │ ├── types.js │ │ └── utils.js ├── react-devtools-shell │ ├── README.md │ ├── index.html │ ├── now.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── DeeplyNestedComponents │ │ │ │ └── index.js │ │ │ ├── EditableProps │ │ │ │ └── index.js │ │ │ ├── ElementTypes │ │ │ │ └── index.js │ │ │ ├── Hydration │ │ │ │ └── index.js │ │ │ ├── Iframe │ │ │ │ └── index.js │ │ │ ├── InspectableElements │ │ │ │ ├── CircularReferences.js │ │ │ │ ├── Contexts.js │ │ │ │ ├── CustomHooks.js │ │ │ │ ├── CustomObject.js │ │ │ │ ├── EdgeCaseObjects.js │ │ │ │ ├── InspectableElements.js │ │ │ │ ├── NestedProps.js │ │ │ │ ├── SimpleValues.js │ │ │ │ ├── SymbolKeys.js │ │ │ │ ├── UnserializableProps.js │ │ │ │ └── index.js │ │ │ ├── InteractionTracing │ │ │ │ └── index.js │ │ │ ├── PriorityLevels │ │ │ │ └── index.js │ │ │ ├── ReactNativeWeb │ │ │ │ └── index.js │ │ │ ├── SuspenseTree │ │ │ │ └── index.js │ │ │ ├── ToDoList │ │ │ │ ├── List.css │ │ │ │ ├── List.js │ │ │ │ ├── ListItem.css │ │ │ │ ├── ListItem.js │ │ │ │ └── index.js │ │ │ ├── Toggle │ │ │ │ └── index.js │ │ │ ├── console.js │ │ │ ├── index.js │ │ │ └── styles.css │ │ └── devtools.js │ └── webpack.config.js ├── react-devtools │ ├── CHANGELOG.md │ ├── OVERVIEW.md │ ├── README.md │ ├── app.html │ ├── app.js │ ├── bin.js │ ├── icons │ │ └── icon128.png │ ├── index.js │ └── package.json ├── react-dom │ ├── README.md │ ├── index.classic.fb.js │ ├── index.experimental.js │ ├── index.js │ ├── index.modern.fb.js │ ├── index.stable.js │ ├── npm │ │ ├── index.js │ │ ├── profiling.js │ │ ├── server.browser.js │ │ ├── server.js │ │ ├── server.node.js │ │ ├── test-utils.js │ │ ├── testing.js │ │ ├── unstable-fizz.browser.js │ │ ├── unstable-fizz.js │ │ └── unstable-fizz.node.js │ ├── package.json │ ├── server.browser.js │ ├── server.js │ ├── server.node.js │ ├── src │ │ ├── __tests__ │ │ │ ├── CSSPropertyOperations-test.js │ │ │ ├── DOMPropertyOperations-test.js │ │ │ ├── InvalidEventListeners-test.js │ │ │ ├── ReactBrowserEventEmitter-test.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 │ │ │ ├── ReactDOMEventPropagation-test.js │ │ │ ├── ReactDOMFiber-test.js │ │ │ ├── ReactDOMFiberAsync-test.js │ │ │ ├── ReactDOMFizzServerBrowser-test.js │ │ │ ├── ReactDOMFizzServerNode-test.js │ │ │ ├── ReactDOMHooks-test.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.js │ │ │ ├── ReactDOMServerIntegrationInput-test.js │ │ │ ├── ReactDOMServerIntegrationLegacyContext-test.js │ │ │ ├── ReactDOMServerIntegrationLegacyContextDisabled-test.internal.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 │ │ │ ├── ReactDOMServerSelectiveHydration-test.internal.js │ │ │ ├── ReactDOMServerSuspense-test.internal.js │ │ │ ├── ReactDOMShorthandCSSPropertyCollision-test.js │ │ │ ├── ReactDOMSuspensePlaceholder-test.js │ │ │ ├── ReactDOMTestSelectors-test.internal.js │ │ │ ├── ReactDOMTextComponent-test.js │ │ │ ├── ReactDOMTextarea-test.js │ │ │ ├── ReactDOMserverIntegrationProgress-test.js │ │ │ ├── ReactDeprecationWarnings-test.internal.js │ │ │ ├── ReactEmptyComponent-test.js │ │ │ ├── ReactErrorBoundaries-test.internal.js │ │ │ ├── ReactErrorLoggingRecovery-test.js │ │ │ ├── ReactEventIndependence-test.js │ │ │ ├── ReactFunctionComponent-test.js │ │ │ ├── ReactIdentity-test.js │ │ │ ├── ReactLegacyContextDisabled-test.internal.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 │ │ │ ├── ReactTestUtilsActUnmockedScheduler-test.js │ │ │ ├── ReactTreeTraversal-test.js │ │ │ ├── ReactUnmockedSchedulerWarning-test.internal.js │ │ │ ├── ReactUnmockedSchedulerWarning-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 │ │ │ ├── DOMAccessibilityRoles.js │ │ │ ├── DOMPropertyOperations.js │ │ │ ├── ReactDOM.js │ │ │ ├── ReactDOMComponent.js │ │ │ ├── ReactDOMComponentTree.js │ │ │ ├── ReactDOMEventHandle.js │ │ │ ├── ReactDOMHostConfig.js │ │ │ ├── ReactDOMInput.js │ │ │ ├── ReactDOMLegacy.js │ │ │ ├── ReactDOMOption.js │ │ │ ├── ReactDOMRoot.js │ │ │ ├── ReactDOMSelect.js │ │ │ ├── ReactDOMSelection.js │ │ │ ├── ReactDOMTextarea.js │ │ │ ├── ReactInputSelection.js │ │ │ ├── ToStringValue.js │ │ │ ├── __tests__ │ │ │ │ ├── dangerouslySetInnerHTML-test.js │ │ │ │ ├── getNodeForCharacterOffset-test.js │ │ │ │ └── trustedTypes-test.internal.js │ │ │ ├── getActiveElement.js │ │ │ ├── getNodeForCharacterOffset.js │ │ │ ├── inputValueTracking.js │ │ │ ├── setInnerHTML.js │ │ │ ├── setTextContent.js │ │ │ └── validateDOMNesting.js │ │ ├── events │ │ │ ├── DOMEventNames.js │ │ │ ├── DOMEventProperties.js │ │ │ ├── DOMPluginEventSystem.js │ │ │ ├── EventListener.js │ │ │ ├── EventRegistry.js │ │ │ ├── EventSystemFlags.js │ │ │ ├── FallbackCompositionState.js │ │ │ ├── PluginModuleType.js │ │ │ ├── ReactDOMControlledComponent.js │ │ │ ├── ReactDOMEventListener.js │ │ │ ├── ReactDOMEventReplaying.js │ │ │ ├── ReactDOMUpdateBatching.js │ │ │ ├── ReactSyntheticEventType.js │ │ │ ├── SyntheticEvent.js │ │ │ ├── TopLevelEventTypes.js │ │ │ ├── __tests__ │ │ │ │ ├── DOMPluginEventSystem-test.internal.js │ │ │ │ ├── SyntheticClipboardEvent-test.js │ │ │ │ ├── SyntheticEvent-test.js │ │ │ │ ├── SyntheticFocusEvent-test.js │ │ │ │ ├── SyntheticKeyboardEvent-test.js │ │ │ │ ├── SyntheticMouseEvent-test.js │ │ │ │ ├── SyntheticWheelEvent-test.js │ │ │ │ └── getEventKey-test.js │ │ │ ├── checkPassiveEvents.js │ │ │ ├── forks │ │ │ │ └── EventListener-www.js │ │ │ ├── getEventCharCode.js │ │ │ ├── getEventTarget.js │ │ │ ├── getListener.js │ │ │ ├── getVendorPrefixedEventName.js │ │ │ ├── isEventSupported.js │ │ │ ├── isTextInputElement.js │ │ │ └── plugins │ │ │ │ ├── BeforeInputEventPlugin.js │ │ │ │ ├── ChangeEventPlugin.js │ │ │ │ ├── EnterLeaveEventPlugin.js │ │ │ │ ├── SelectEventPlugin.js │ │ │ │ ├── SimpleEventPlugin.js │ │ │ │ └── __tests__ │ │ │ │ ├── BeforeInputEventPlugin-test.js │ │ │ │ ├── ChangeEventPlugin-test.js │ │ │ │ ├── EnterLeaveEventPlugin-test.js │ │ │ │ ├── SelectEventPlugin-test.js │ │ │ │ └── SimpleEventPlugin-test.js │ │ ├── server │ │ │ ├── DOMMarkupOperations.js │ │ │ ├── ReactDOMFizzServerBrowser.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 │ │ │ ├── ReactDOMTypes.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 │ │ │ ├── ReactTestUtilsInternalAct.js │ │ │ └── ReactTestUtilsPublicAct.js │ ├── test-utils.js │ ├── testing.classic.fb.js │ ├── testing.experimental.js │ ├── testing.js │ ├── testing.modern.fb.js │ ├── testing.stable.js │ ├── unstable-fizz.browser.js │ ├── unstable-fizz.js │ └── unstable-fizz.node.js ├── react-fetch │ ├── README.md │ ├── index.browser.js │ ├── index.js │ ├── index.node.js │ ├── npm │ │ ├── index.browser.js │ │ ├── index.js │ │ └── index.node.js │ ├── package.json │ └── src │ │ ├── ReactFetchBrowser.js │ │ ├── ReactFetchNode.js │ │ └── __tests__ │ │ ├── ReactFetchBrowser-test.js │ │ └── ReactFetchNode-test.js ├── react-interactions │ ├── README.md │ ├── events │ │ ├── focus.js │ │ └── src │ │ │ └── dom │ │ │ └── create-event-handle │ │ │ ├── Focus.js │ │ │ ├── __tests__ │ │ │ ├── useFocus-test.internal.js │ │ │ └── useFocusWithin-test.internal.js │ │ │ └── useEvent.js │ ├── npm │ │ ├── drag.js │ │ ├── focus.js │ │ ├── hover.js │ │ ├── input.js │ │ ├── press-legacy.js │ │ ├── press.js │ │ ├── scroll.js │ │ ├── swipe.js │ │ └── tap.js │ └── package.json ├── 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 │ │ ├── NativeMethodsMixinUtils.js │ │ ├── ReactFabric.js │ │ ├── ReactFabricComponentTree.js │ │ ├── ReactFabricEventEmitter.js │ │ ├── ReactFabricGlobalResponderHandler.js │ │ ├── ReactFabricHostConfig.js │ │ ├── ReactFabricInjection.js │ │ ├── ReactNativeAttributePayload.js │ │ ├── ReactNativeBridgeEventPlugin.js │ │ ├── ReactNativeComponentTree.js │ │ ├── ReactNativeEventEmitter.js │ │ ├── ReactNativeEventPluginOrder.js │ │ ├── ReactNativeFiberHostComponent.js │ │ ├── ReactNativeFiberInspector.js │ │ ├── ReactNativeGetListener.js │ │ ├── ReactNativeGlobalResponderHandler.js │ │ ├── ReactNativeHostConfig.js │ │ ├── ReactNativeInjection.js │ │ ├── ReactNativeInjectionShared.js │ │ ├── ReactNativeRenderer.js │ │ ├── ReactNativeTypes.js │ │ ├── __mocks__ │ │ └── react-native │ │ │ └── Libraries │ │ │ └── ReactPrivate │ │ │ ├── BatchedBridge.js │ │ │ ├── ExceptionsManager.js │ │ │ ├── InitializeNativeFabricUIManager.js │ │ │ ├── Platform.js │ │ │ ├── RCTEventEmitter.js │ │ │ ├── ReactFiberErrorDialog.js │ │ │ ├── ReactNativePrivateInitializeCore.js │ │ │ ├── ReactNativePrivateInterface.js │ │ │ ├── ReactNativeViewConfigRegistry.js │ │ │ ├── TextInputState.js │ │ │ ├── UIManager.js │ │ │ ├── deepDiffer.js │ │ │ ├── deepFreezeAndThrowOnMutationInDev.js │ │ │ └── flattenStyle.js │ │ ├── __tests__ │ │ ├── EventPluginRegistry-test.internal.js │ │ ├── ReactFabric-test.internal.js │ │ ├── ReactFabricAndNative-test.internal.js │ │ ├── ReactNativeAttributePayload-test.js │ │ ├── ReactNativeError-test.internal.js │ │ ├── ReactNativeEvents-test.internal.js │ │ ├── ReactNativeMount-test.internal.js │ │ ├── ResponderEventPlugin-test.internal.js │ │ ├── __snapshots__ │ │ │ ├── ReactFabric-test.internal.js.snap │ │ │ ├── ReactNativeEvents-test.internal.js.snap │ │ │ └── ReactNativeMount-test.internal.js.snap │ │ └── createReactNativeComponentClass-test.internal.js │ │ └── legacy-events │ │ ├── EventBatching.js │ │ ├── EventPluginRegistry.js │ │ ├── EventPluginUtils.js │ │ ├── PluginModuleType.js │ │ ├── ReactGenericBatching.js │ │ ├── ReactSyntheticEventType.js │ │ ├── ResponderEventPlugin.js │ │ ├── ResponderSyntheticEvent.js │ │ ├── ResponderTopLevelEventTypes.js │ │ ├── ResponderTouchHistoryStore.js │ │ ├── SyntheticEvent.js │ │ ├── TopLevelEventTypes.js │ │ ├── accumulate.js │ │ ├── accumulateInto.js │ │ └── forEachAccumulated.js ├── react-noop-renderer │ ├── README.md │ ├── flight-client.js │ ├── flight-modules.js │ ├── flight-server-runtime.js │ ├── flight-server.js │ ├── index.js │ ├── npm │ │ ├── flight-client.js │ │ ├── flight-modules.js │ │ ├── flight-server-runtime.js │ │ ├── flight-server.js │ │ ├── index.js │ │ ├── persistent.js │ │ └── server.js │ ├── package.json │ ├── persistent.js │ ├── server.js │ └── src │ │ ├── ReactNoop.js │ │ ├── ReactNoopFlightClient.js │ │ ├── ReactNoopFlightServer.js │ │ ├── ReactNoopPersistent.js │ │ ├── ReactNoopServer.js │ │ └── createReactNoop.js ├── react-reconciler │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ └── reflection.js │ ├── package.json │ ├── reflection.js │ └── src │ │ ├── DebugTracing.js │ │ ├── MaxInts.js │ │ ├── ReactCapturedValue.js │ │ ├── ReactChildFiber.new.js │ │ ├── ReactChildFiber.old.js │ │ ├── ReactCurrentFiber.js │ │ ├── ReactFiber.new.js │ │ ├── ReactFiber.old.js │ │ ├── ReactFiberBeginWork.new.js │ │ ├── ReactFiberBeginWork.old.js │ │ ├── ReactFiberClassComponent.new.js │ │ ├── ReactFiberClassComponent.old.js │ │ ├── ReactFiberCommitWork.new.js │ │ ├── ReactFiberCommitWork.old.js │ │ ├── ReactFiberCompleteWork.new.js │ │ ├── ReactFiberCompleteWork.old.js │ │ ├── ReactFiberComponentStack.js │ │ ├── ReactFiberContext.new.js │ │ ├── ReactFiberContext.old.js │ │ ├── ReactFiberDevToolsHook.new.js │ │ ├── ReactFiberDevToolsHook.old.js │ │ ├── ReactFiberErrorDialog.js │ │ ├── ReactFiberErrorLogger.js │ │ ├── ReactFiberFlags.js │ │ ├── ReactFiberFundamental.new.js │ │ ├── ReactFiberFundamental.old.js │ │ ├── ReactFiberHooks.new.js │ │ ├── ReactFiberHooks.old.js │ │ ├── ReactFiberHostConfig.js │ │ ├── ReactFiberHostConfigWithNoHydration.js │ │ ├── ReactFiberHostConfigWithNoMutation.js │ │ ├── ReactFiberHostConfigWithNoPersistence.js │ │ ├── ReactFiberHostConfigWithNoScopes.js │ │ ├── ReactFiberHostConfigWithNoTestSelectors.js │ │ ├── ReactFiberHostContext.new.js │ │ ├── ReactFiberHostContext.old.js │ │ ├── ReactFiberHotReloading.js │ │ ├── ReactFiberHotReloading.new.js │ │ ├── ReactFiberHotReloading.old.js │ │ ├── ReactFiberHydrationContext.new.js │ │ ├── ReactFiberHydrationContext.old.js │ │ ├── ReactFiberLane.js │ │ ├── ReactFiberLazyComponent.new.js │ │ ├── ReactFiberLazyComponent.old.js │ │ ├── ReactFiberNewContext.new.js │ │ ├── ReactFiberNewContext.old.js │ │ ├── ReactFiberOffscreenComponent.js │ │ ├── ReactFiberReconciler.js │ │ ├── ReactFiberReconciler.new.js │ │ ├── ReactFiberReconciler.old.js │ │ ├── ReactFiberRoot.new.js │ │ ├── ReactFiberRoot.old.js │ │ ├── ReactFiberScope.new.js │ │ ├── ReactFiberScope.old.js │ │ ├── ReactFiberStack.new.js │ │ ├── ReactFiberStack.old.js │ │ ├── ReactFiberSuspenseComponent.new.js │ │ ├── ReactFiberSuspenseComponent.old.js │ │ ├── ReactFiberSuspenseContext.new.js │ │ ├── ReactFiberSuspenseContext.old.js │ │ ├── ReactFiberThrow.new.js │ │ ├── ReactFiberThrow.old.js │ │ ├── ReactFiberTransition.js │ │ ├── ReactFiberTreeReflection.js │ │ ├── ReactFiberUnwindWork.new.js │ │ ├── ReactFiberUnwindWork.old.js │ │ ├── ReactFiberWorkLoop.new.js │ │ ├── ReactFiberWorkLoop.old.js │ │ ├── ReactHookEffectTags.js │ │ ├── ReactInternalTypes.js │ │ ├── ReactMutableSource.new.js │ │ ├── ReactMutableSource.old.js │ │ ├── ReactPortal.js │ │ ├── ReactProfilerTimer.new.js │ │ ├── ReactProfilerTimer.old.js │ │ ├── ReactRootTags.js │ │ ├── ReactStrictModeWarnings.new.js │ │ ├── ReactStrictModeWarnings.old.js │ │ ├── ReactTestSelectors.js │ │ ├── ReactTypeOfMode.js │ │ ├── ReactUpdateQueue.new.js │ │ ├── ReactUpdateQueue.old.js │ │ ├── ReactWorkTags.js │ │ ├── SchedulerWithReactIntegration.new.js │ │ ├── SchedulerWithReactIntegration.old.js │ │ ├── SchedulingProfiler.js │ │ ├── __tests__ │ │ ├── DebugTracing-test.internal.js │ │ ├── ErrorBoundaryReconciliation-test.internal.js │ │ ├── ReactBatchedMode-test.internal.js │ │ ├── ReactBlocks-test.js │ │ ├── ReactCPUSuspense-test.js │ │ ├── ReactDisableSchedulerTimeoutBasedOnReactExpirationTime-test.internal.js │ │ ├── ReactDoubleInvokeEvents-test.internal.js │ │ ├── ReactExpiration-test.js │ │ ├── ReactFiberFundamental-test.internal.js │ │ ├── ReactFiberHostContext-test.internal.js │ │ ├── ReactFragment-test.js │ │ ├── ReactHooks-test.internal.js │ │ ├── ReactHooksWithNoopRenderer-test.js │ │ ├── ReactIncremental-test.js │ │ ├── ReactIncrementalErrorHandling-test.internal.js │ │ ├── ReactIncrementalErrorLogging-test.js │ │ ├── ReactIncrementalErrorReplay-test.internal.js │ │ ├── ReactIncrementalErrorReplay-test.js │ │ ├── ReactIncrementalReflection-test.js │ │ ├── ReactIncrementalScheduling-test.js │ │ ├── ReactIncrementalSideEffects-test.js │ │ ├── ReactIncrementalTriangle-test.js │ │ ├── ReactIncrementalUpdates-test.js │ │ ├── ReactIncrementalUpdatesMinimalism-test.js │ │ ├── ReactLazy-test.internal.js │ │ ├── ReactMemo-test.js │ │ ├── ReactNewContext-test.js │ │ ├── ReactNoopRendererAct-test.js │ │ ├── ReactOffscreen-test.js │ │ ├── ReactPersistent-test.js │ │ ├── ReactPersistentUpdatesMinimalism-test.js │ │ ├── ReactSchedulerIntegration-test.js │ │ ├── ReactScope-test.internal.js │ │ ├── ReactSuspense-test.internal.js │ │ ├── ReactSuspenseCallback-test.internal.js │ │ ├── ReactSuspenseFuzz-test.internal.js │ │ ├── ReactSuspenseList-test.js │ │ ├── ReactSuspensePlaceholder-test.internal.js │ │ ├── ReactSuspenseWithNoopRenderer-test.js │ │ ├── ReactTopLevelFragment-test.js │ │ ├── ReactTopLevelText-test.js │ │ ├── ReactTracing-test.internal.js │ │ ├── ReactTransition-test.js │ │ ├── SchedulingProfiler-test.internal.js │ │ ├── __snapshots__ │ │ │ └── ReactHooks-test.internal.js.snap │ │ ├── useMutableSource-test.internal.js │ │ └── useMutableSourceHydration-test.js │ │ └── forks │ │ ├── ReactFiberErrorDialog.native.js │ │ ├── ReactFiberErrorDialog.www.js │ │ ├── ReactFiberHostConfig.art.js │ │ ├── ReactFiberHostConfig.custom.js │ │ ├── ReactFiberHostConfig.dom-browser.js │ │ ├── ReactFiberHostConfig.dom-relay.js │ │ ├── ReactFiberHostConfig.dom.js │ │ ├── ReactFiberHostConfig.fabric.js │ │ ├── ReactFiberHostConfig.native.js │ │ └── ReactFiberHostConfig.test.js ├── react-refresh │ ├── README.md │ ├── babel.js │ ├── npm │ │ ├── babel.js │ │ └── runtime.js │ ├── package.json │ ├── runtime.js │ └── src │ │ ├── ReactFreshBabelPlugin.js │ │ ├── ReactFreshRuntime.js │ │ └── __tests__ │ │ ├── ReactFresh-test.js │ │ ├── ReactFreshBabelPlugin-test.js │ │ ├── ReactFreshIntegration-test.js │ │ ├── ReactFreshMultipleRenderer-test.internal.js │ │ └── __snapshots__ │ │ └── ReactFreshBabelPlugin-test.js.snap ├── react-server │ ├── README.md │ ├── flight-server-runtime.js │ ├── flight.js │ ├── index.js │ ├── npm │ │ ├── flight-server-runtime.js │ │ ├── flight.js │ │ └── index.js │ ├── package.json │ └── src │ │ ├── ReactDOMServerFormatConfig.js │ │ ├── ReactFizzServer.js │ │ ├── ReactFlightServer.js │ │ ├── ReactFlightServerBundlerConfigCustom.js │ │ ├── ReactFlightServerConfig.js │ │ ├── ReactFlightServerConfigStream.js │ │ ├── ReactFlightServerRuntime.js │ │ ├── ReactServerFormatConfig.js │ │ ├── ReactServerStreamConfig.js │ │ ├── ReactServerStreamConfigBrowser.js │ │ ├── ReactServerStreamConfigNode.js │ │ ├── __tests__ │ │ └── ReactServer-test.js │ │ └── forks │ │ ├── ReactFlightServerConfig.custom.js │ │ ├── ReactFlightServerConfig.dom-browser.js │ │ ├── ReactFlightServerConfig.dom-relay.js │ │ ├── ReactFlightServerConfig.dom.js │ │ ├── ReactServerFormatConfig.custom.js │ │ ├── ReactServerFormatConfig.dom-browser.js │ │ ├── ReactServerFormatConfig.dom-relay.js │ │ ├── ReactServerFormatConfig.dom.js │ │ ├── ReactServerStreamConfig.custom.js │ │ ├── ReactServerStreamConfig.dom-browser.js │ │ ├── ReactServerStreamConfig.dom-relay.js │ │ └── ReactServerStreamConfig.dom.js ├── react-test-renderer │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ └── shallow.js │ ├── package.json │ ├── shallow.js │ └── src │ │ ├── ReactTestHostConfig.js │ │ ├── ReactTestRenderer.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-transport-dom-relay │ ├── index.js │ ├── package.json │ ├── server-runtime.js │ ├── server.js │ └── src │ │ ├── ReactFlightDOMRelayClient.js │ │ ├── ReactFlightDOMRelayClientHostConfig.js │ │ ├── ReactFlightDOMRelayServer.js │ │ ├── ReactFlightDOMRelayServerHostConfig.js │ │ ├── __mocks__ │ │ ├── ReactFlightDOMRelayClientIntegration.js │ │ └── ReactFlightDOMRelayServerIntegration.js │ │ └── __tests__ │ │ └── ReactFlightDOMRelay-test.internal.js ├── react-transport-dom-webpack │ ├── README.md │ ├── index.js │ ├── npm │ │ ├── index.js │ │ ├── plugin.js │ │ ├── server-runtime.js │ │ ├── server.browser.js │ │ ├── server.js │ │ └── server.node.js │ ├── package.json │ ├── plugin.js │ ├── server-runtime.js │ ├── server.browser.js │ ├── server.js │ ├── server.node.js │ └── src │ │ ├── ReactFlightClientWebpackBundlerConfig.js │ │ ├── ReactFlightDOMClient.js │ │ ├── ReactFlightDOMServerBrowser.js │ │ ├── ReactFlightDOMServerNode.js │ │ ├── ReactFlightServerWebpackBundlerConfig.js │ │ ├── ReactFlightWebpackPlugin.js │ │ └── __tests__ │ │ ├── ReactFlightDOM-test.js │ │ └── ReactFlightDOMBrowser-test.js ├── react │ ├── README.md │ ├── index.classic.fb.js │ ├── index.experimental.js │ ├── index.js │ ├── index.modern.fb.js │ ├── index.stable.js │ ├── jsx-dev-runtime.js │ ├── jsx-runtime.js │ ├── npm │ │ ├── index.js │ │ ├── jsx-dev-runtime.js │ │ ├── jsx-runtime.js │ │ └── unstable-cache.js │ ├── package.json │ ├── src │ │ ├── BadMapPolyfill.js │ │ ├── IsSomeRendererActing.js │ │ ├── React.js │ │ ├── ReactBaseClasses.js │ │ ├── ReactBlock.js │ │ ├── ReactChildren.js │ │ ├── ReactContext.js │ │ ├── ReactCreateRef.js │ │ ├── ReactCurrentBatchConfig.js │ │ ├── ReactCurrentDispatcher.js │ │ ├── ReactCurrentOwner.js │ │ ├── ReactDebugCurrentFrame.js │ │ ├── ReactElement.js │ │ ├── ReactElementValidator.js │ │ ├── ReactForwardRef.js │ │ ├── ReactFundamental.js │ │ ├── ReactHooks.js │ │ ├── ReactLazy.js │ │ ├── ReactMemo.js │ │ ├── ReactMutableSource.js │ │ ├── ReactNoopUpdateQueue.js │ │ ├── ReactSharedInternals.js │ │ ├── ReactStartTransition.js │ │ ├── __tests__ │ │ │ ├── ReactCache-test.js │ │ │ ├── ReactChildren-test.js │ │ │ ├── ReactClassEquivalence-test.js │ │ │ ├── ReactCoffeeScriptClass-test.coffee │ │ │ ├── ReactContextValidator-test.js │ │ │ ├── ReactCreateRef-test.js │ │ │ ├── ReactDOMTracing-test.internal.js │ │ │ ├── ReactES6Class-test.js │ │ │ ├── ReactElement-test.js │ │ │ ├── ReactElementClone-test.js │ │ │ ├── ReactElementJSX-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.js │ │ │ ├── ReactTypeScriptClass-test.ts │ │ │ ├── __snapshots__ │ │ │ │ └── ReactProfiler-test.internal.js.snap │ │ │ ├── createReactClassIntegration-test.js │ │ │ ├── forwardRef-test.internal.js │ │ │ ├── forwardRef-test.js │ │ │ ├── onlyChild-test.js │ │ │ └── testDefinitions │ │ │ │ ├── PropTypes.d.ts │ │ │ │ ├── React.d.ts │ │ │ │ └── ReactDOM.d.ts │ │ ├── cache │ │ │ └── ReactCache.js │ │ ├── forks │ │ │ ├── ReactCurrentDispatcher.www.js │ │ │ ├── ReactCurrentOwner.www.js │ │ │ └── ReactSharedInternals.umd.js │ │ └── jsx │ │ │ ├── ReactJSX.js │ │ │ ├── ReactJSXElement.js │ │ │ └── ReactJSXElementValidator.js │ └── unstable-cache.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 │ │ └── unstable_post_task.js │ ├── package.json │ ├── src │ │ ├── Scheduler.js │ │ ├── SchedulerFeatureFlags.js │ │ ├── SchedulerHostConfig.js │ │ ├── SchedulerMinHeap.js │ │ ├── SchedulerPostTask.js │ │ ├── SchedulerPriorities.js │ │ ├── SchedulerProfiling.js │ │ ├── Tracing.js │ │ ├── TracingSubscriptions.js │ │ ├── __tests__ │ │ │ ├── Scheduler-test.js │ │ │ ├── SchedulerBrowser-test.js │ │ │ ├── SchedulerNoDOM-test.js │ │ │ ├── SchedulerPostTask-test.js │ │ │ ├── SchedulerProfiling-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 │ └── unstable_post_task.js ├── shared │ ├── ConsolePatchingDev.js │ ├── ExecutionEnvironment.js │ ├── ReactComponentStackFrame.js │ ├── ReactElementType.js │ ├── ReactErrorUtils.js │ ├── ReactFeatureFlags.js │ ├── ReactInstanceMap.js │ ├── ReactSharedInternals.js │ ├── ReactSymbols.js │ ├── ReactTypes.js │ ├── ReactVersion.js │ ├── __tests__ │ │ ├── ReactDOMFrameScheduling-test.js │ │ ├── ReactError-test.internal.js │ │ ├── ReactErrorProd-test.internal.js │ │ ├── ReactErrorUtils-test.internal.js │ │ ├── ReactSymbols-test.internal.js │ │ └── describeComponentFrame-test.js │ ├── checkPropTypes.js │ ├── consoleWithStackDev.js │ ├── enqueueTask.js │ ├── forks │ │ ├── ReactFeatureFlags.native-fb.js │ │ ├── ReactFeatureFlags.native-oss.js │ │ ├── ReactFeatureFlags.readonly.js │ │ ├── ReactFeatureFlags.test-renderer.js │ │ ├── ReactFeatureFlags.test-renderer.native.js │ │ ├── ReactFeatureFlags.test-renderer.www.js │ │ ├── ReactFeatureFlags.testing.js │ │ ├── ReactFeatureFlags.testing.www.js │ │ ├── ReactFeatureFlags.www-dynamic.js │ │ ├── ReactFeatureFlags.www.js │ │ ├── Scheduler.umd.js │ │ ├── SchedulerTracing.umd.js │ │ ├── consoleWithStackDev.www.js │ │ ├── invokeGuardedCallbackImpl.www.js │ │ ├── object-assign.inline-umd.js │ │ └── object-assign.umd.js │ ├── formatProdErrorMessage.js │ ├── getComponentName.js │ ├── invariant.js │ ├── invokeGuardedCallbackImpl.js │ ├── isValidElementType.js │ ├── objectIs.js │ ├── package.json │ └── shallowEqual.js └── use-subscription │ ├── README.md │ ├── index.js │ ├── npm │ └── index.js │ ├── package.json │ └── src │ ├── __tests__ │ └── useSubscription-test.js │ └── useSubscription.js ├── react ├── React Hook useEffect.md ├── React Hook useState 状态更新.md ├── React Hook useState.md ├── React commit 阶段.md ├── React render 流程三 (completeWork).md ├── React render 流程二 (beginWork).md ├── React render流程 一.md ├── React 更新之 setState.md ├── React 状态更新 一.md ├── React 状态更新之 ReactDOM.render 是如何渲染state 的.md ├── React.createElement.md ├── React是如何创建FiberNode的.md └── img │ ├── QQ20220314-230014@2x.png │ ├── QQ20220316-111728.png │ ├── QQ20220317-153247.png │ ├── QQ20220318-171230.png │ ├── WX20220310-121500.png │ ├── image-20220302140906771.png │ ├── image-20220310121153997.png │ └── image-20220418212951811.png ├── src ├── app.jsx ├── demo │ ├── demo01.jsx │ └── useEffect.jsx ├── index.html └── index.jsx ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-react"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-code-test", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "webpack serve" 8 | }, 9 | "devDependencies": { 10 | "@babel/core": "^7.15.8", 11 | "@babel/preset-flow": "^7.14.5", 12 | "@babel/preset-react": "^7.14.5", 13 | "babel-loader": "^8.2.3", 14 | "html-webpack-plugin": "^5.5.0", 15 | "webpack": "^5.60.0", 16 | "webpack-cli": "^4.9.1", 17 | "webpack-dev-server": "^4.3.1" 18 | }, 19 | "dependencies": { 20 | "object-assign": "^4.1.1" 21 | }, 22 | "keywords": [], 23 | "author": "", 24 | "license": "ISC" 25 | } 26 | -------------------------------------------------------------------------------- /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": "17.0.0", 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": "^17.0.0" 19 | }, 20 | "devDependencies": { 21 | "rxjs": "^5.5.6" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/dom-event-testing-library/__tests__/__snapshots__/index-test.internal.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`describeWithPointerEvent: MouseEvent/TouchEvent provides boolean to tests 1`] = `false`; 4 | 5 | exports[`describeWithPointerEvent: MouseEvent/TouchEvent testWithPointerType: mouse 1`] = `"mouse"`; 6 | 7 | exports[`describeWithPointerEvent: MouseEvent/TouchEvent testWithPointerType: touch 1`] = `"touch"`; 8 | 9 | exports[`describeWithPointerEvent: PointerEvent provides boolean to tests 1`] = `true`; 10 | 11 | exports[`describeWithPointerEvent: PointerEvent testWithPointerType: mouse 1`] = `"mouse"`; 12 | 13 | exports[`describeWithPointerEvent: PointerEvent testWithPointerType: pen 1`] = `"pen"`; 14 | 15 | exports[`describeWithPointerEvent: PointerEvent testWithPointerType: touch 1`] = `"touch"`; 16 | -------------------------------------------------------------------------------- /packages/dom-event-testing-library/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "dom-event-testing-library", 4 | "version": "0.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /packages/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 | export * from './src/index'; 9 | -------------------------------------------------------------------------------- /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 RulesOfHooks from './RulesOfHooks'; 11 | import ExhaustiveDeps from './ExhaustiveDeps'; 12 | 13 | export const configs = { 14 | recommended: { 15 | plugins: ['react-hooks'], 16 | rules: { 17 | 'react-hooks/rules-of-hooks': 'error', 18 | 'react-hooks/exhaustive-deps': 'warn', 19 | }, 20 | }, 21 | }; 22 | 23 | export const rules = { 24 | 'rules-of-hooks': RulesOfHooks, 25 | 'exhaustive-deps': ExhaustiveDeps, 26 | }; 27 | -------------------------------------------------------------------------------- /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 || ^24.0.0 || ^25.1.0", 23 | "scheduler": "^0.20.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/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 | export {default} from './npm/Circle'; 11 | -------------------------------------------------------------------------------- /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 | export {default} from './npm/Rectangle'; 11 | -------------------------------------------------------------------------------- /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 | export {default} from './npm/Wedge'; 11 | -------------------------------------------------------------------------------- /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 | export * from './src/ReactART'; 11 | -------------------------------------------------------------------------------- /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-art/src/ReactARTInternals.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 const TYPES = { 9 | CLIPPING_RECTANGLE: 'ClippingRectangle', 10 | GROUP: 'Group', 11 | SHAPE: 'Shape', 12 | TEXT: 'Text', 13 | }; 14 | 15 | export const EVENT_TYPES = { 16 | onClick: 'click', 17 | onMouseMove: 'mousemove', 18 | onMouseOver: 'mouseover', 19 | onMouseOut: 'mouseout', 20 | onMouseUp: 'mouseup', 21 | onMouseDown: 'mousedown', 22 | }; 23 | 24 | export function childrenAsString(children) { 25 | if (!children) { 26 | return ''; 27 | } else if (typeof children === 'string') { 28 | return children; 29 | } else if (children.length) { 30 | return children.join(''); 31 | } else { 32 | return ''; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /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/ReactCacheOld'; 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": "^17.0.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/react-client/README.md: -------------------------------------------------------------------------------- 1 | # react-client 2 | 3 | This is an experimental package for consuming custom React streaming models. 4 | 5 | **Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.** 6 | 7 | **Use it at your own risk.** 8 | -------------------------------------------------------------------------------- /packages/react-client/flight.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 './src/ReactFlightClientStream'; 11 | -------------------------------------------------------------------------------- /packages/react-client/npm/flight.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-client-flight.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-client-flight.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-client/src/ReactFlightClientHostConfig.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 | /* eslint-disable react-internal/invariant-args */ 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // We expect that our Rollup, Jest, and Flow configurations 15 | // always shim this module with the corresponding host config 16 | // (either provided by a renderer, or a generic shim for npm). 17 | // 18 | // We should never resolve to this file, but it exists to make 19 | // sure that if we *do* accidentally break the configuration, 20 | // the failure isn't silent. 21 | 22 | invariant(false, 'This module must be shimmed by a specific renderer.'); 23 | -------------------------------------------------------------------------------- /packages/react-client/src/ReactFlightClientHostConfigBrowser.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 StringDecoder = TextDecoder; 11 | 12 | export const supportsBinaryStreams = true; 13 | 14 | export function createStringDecoder(): StringDecoder { 15 | return new TextDecoder(); 16 | } 17 | 18 | const decoderOptions = {stream: true}; 19 | 20 | export function readPartialStringChunk( 21 | decoder: StringDecoder, 22 | buffer: Uint8Array, 23 | ): string { 24 | return decoder.decode(buffer, decoderOptions); 25 | } 26 | 27 | export function readFinalStringChunk( 28 | decoder: StringDecoder, 29 | buffer: Uint8Array, 30 | ): string { 31 | return decoder.decode(buffer); 32 | } 33 | -------------------------------------------------------------------------------- /packages/react-client/src/ReactFlightClientHostConfigNoStream.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 StringDecoder = void; 11 | 12 | export const supportsBinaryStreams = false; 13 | 14 | export function createStringDecoder(): void { 15 | throw new Error('Should never be called'); 16 | } 17 | 18 | export function readPartialStringChunk( 19 | decoder: StringDecoder, 20 | buffer: Uint8Array, 21 | ): string { 22 | throw new Error('Should never be called'); 23 | } 24 | 25 | export function readFinalStringChunk( 26 | decoder: StringDecoder, 27 | buffer: Uint8Array, 28 | ): string { 29 | throw new Error('Should never be called'); 30 | } 31 | -------------------------------------------------------------------------------- /packages/react-client/src/ReactFlightClientHostConfigStream.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 {ResponseBase} from './ReactFlightClient'; 11 | import type {StringDecoder} from './ReactFlightClientHostConfig'; 12 | 13 | export type Response = ResponseBase & { 14 | _partialRow: string, 15 | _fromJSON: (key: string, value: JSONValue) => any, 16 | _stringDecoder: StringDecoder, 17 | }; 18 | 19 | export type UninitializedModel = string; 20 | 21 | export function parseModel(response: Response, json: UninitializedModel): T { 22 | return JSON.parse(json, response._fromJSON); 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-client/src/forks/ReactFlightClientHostConfig.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-client/src/ReactFlightClientHostConfigBrowser'; 11 | export * from 'react-client/src/ReactFlightClientHostConfigStream'; 12 | export * from 'react-transport-dom-webpack/src/ReactFlightClientWebpackBundlerConfig'; 13 | -------------------------------------------------------------------------------- /packages/react-client/src/forks/ReactFlightClientHostConfig.dom-relay.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-transport-dom-relay/src/ReactFlightDOMRelayClientHostConfig'; 11 | export * from '../ReactFlightClientHostConfigNoStream'; 12 | -------------------------------------------------------------------------------- /packages/react-client/src/forks/ReactFlightClientHostConfig.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-client/src/ReactFlightClientHostConfigBrowser'; 11 | export * from 'react-client/src/ReactFlightClientHostConfigStream'; 12 | export * from 'react-transport-dom-webpack/src/ReactFlightClientWebpackBundlerConfig'; 13 | -------------------------------------------------------------------------------- /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 | export * from './src/ReactDebugTools'; 9 | -------------------------------------------------------------------------------- /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/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-debug-tools", 4 | "description": "React package for debugging React trees.", 5 | "version": "0.16.0", 6 | "keywords": [ 7 | "react" 8 | ], 9 | "homepage": "https://reactjs.org/", 10 | "bugs": "https://github.com/facebook/react/issues", 11 | "license": "MIT", 12 | "files": [ 13 | "LICENSE", 14 | "README.md", 15 | "build-info.json", 16 | "index.js", 17 | "cjs/" 18 | ], 19 | "main": "index.js", 20 | "repository": { 21 | "type" : "git", 22 | "url" : "https://github.com/facebook/react.git", 23 | "directory": "packages/react-debug-tools" 24 | }, 25 | "engines": { 26 | "node": ">=0.10.0" 27 | }, 28 | "peerDependencies": { 29 | "react": "^17.0.0" 30 | }, 31 | "dependencies": { 32 | "error-stack-parser": "^2.0.2", 33 | "object-assign": "^4.1.1" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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-devtools-core/backend.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/backend'); 2 | -------------------------------------------------------------------------------- /packages/react-devtools-core/standalone.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/standalone'); 2 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/chrome/README.md: -------------------------------------------------------------------------------- 1 | # The Chrome extension 2 | 3 | The source code for this extension has moved to `shells/webextension`. 4 | 5 | Modify the source code there and then rebuild this extension by running `node build` from this directory or `yarn run build:extension:chrome` from the root directory. 6 | 7 | ## Testing in Chrome 8 | 9 | You can test a local build of the web extension like so: 10 | 11 | 1. Build the extension: `node build` 12 | 1. Follow the on-screen instructions. 13 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/chrome/deploy.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const deploy = require('../deploy'); 6 | 7 | const main = async () => await deploy('chrome'); 8 | 9 | main(); 10 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/chrome/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools-experimental-chrome", 3 | "alias": ["react-devtools-experimental-chrome"], 4 | "files": ["index.html", "ReactDevTools.zip"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/chrome/test.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const chromeLaunch = require('chrome-launch'); 6 | const {resolve} = require('path'); 7 | const {argv} = require('yargs'); 8 | 9 | const EXTENSION_PATH = resolve('./chrome/build/unpacked'); 10 | const START_URL = argv.url || 'https://reactjs.org/'; 11 | 12 | chromeLaunch(START_URL, { 13 | args: [ 14 | // Load the React DevTools extension 15 | `--load-extension=${EXTENSION_PATH}`, 16 | 17 | // Automatically open DevTools window 18 | '--auto-open-devtools-for-tabs', 19 | 20 | // Remembers previous session settings (e.g. DevTools size/position) 21 | '--user-data-dir=./.tempUserDataDir', 22 | ], 23 | }); 24 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/deploy.chrome.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. download extension
  2. 3 |
  3. Double-click to extract
  4. 4 |
  5. Navigate to chrome://extensions/
  6. 5 |
  7. Enable "Developer mode"
  8. 6 |
  9. Click "LOAD UNPACKED"
  10. 7 |
  11. Select extracted extension folder (ReactDevTools)
  12. 8 |
-------------------------------------------------------------------------------- /packages/react-devtools-extensions/deploy.edge.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. download extension
  2. 3 |
  3. Double-click to extract
  4. 4 |
  5. Navigate to edge://extensions/
  6. 5 |
  7. Enable "Developer mode"
  8. 6 |
  9. Click "LOAD UNPACKED"
  10. 7 |
  11. Select extracted extension folder (ReactDevTools)
  12. 8 |
-------------------------------------------------------------------------------- /packages/react-devtools-extensions/deploy.firefox.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. download extension
  2. 3 |
  3. Extract/unzip
  4. 4 |
  5. Visit about:debugging
  6. 5 |
  7. Click "Load Temporary Add-on"
  8. 6 |
  9. Select the manifest.json file inside of the extracted extension folder (ReactDevTools)
  10. 7 |
-------------------------------------------------------------------------------- /packages/react-devtools-extensions/edge/README.md: -------------------------------------------------------------------------------- 1 | # The Microsoft Edge extension 2 | 3 | The source code for this extension has moved to `shells/webextension`. 4 | 5 | Modify the source code there and then rebuild this extension by running `node build` from this directory or `yarn run build:extension:edge` from the root directory. 6 | 7 | ## Testing in Microsoft Edge 8 | 9 | You can test a local build of the web extension like so: 10 | 11 | 1. Build the extension: `node build` 12 | 1. Follow the on-screen instructions. 13 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/edge/deploy.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const deploy = require('../deploy'); 6 | 7 | const main = async () => await deploy('edge'); 8 | 9 | main(); 10 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/edge/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools-experimental-edge", 3 | "alias": ["react-devtools-experimental-edge"], 4 | "files": ["index.html", "ReactDevTools.zip"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/firefox/README.md: -------------------------------------------------------------------------------- 1 | # The Firefox extension 2 | 3 | The source code for this extension has moved to `shells/webextension`. 4 | 5 | Modify the source code there and then rebuild this extension by running `node build` from this directory or `yarn run build:extension:firefox` from the root directory. 6 | 7 | ## Testing in Firefox 8 | 9 | 1. Build the extension: `node build` 10 | 1. Follow the on-screen instructions. 11 | 12 | You can test upcoming releases of Firefox by downloading the Beta or Nightly build from the [Firefox releases](https://www.mozilla.org/en-US/firefox/channel/desktop/) page and then following the on-screen instructions after building. 13 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/firefox/deploy.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const deploy = require('../deploy'); 6 | 7 | const main = async () => await deploy('firefox'); 8 | 9 | main(); 10 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/firefox/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools-experimental-firefox", 3 | "alias": ["react-devtools-experimental-firefox"], 4 | "files": ["index.html", "ReactDevTools.zip"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/128-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/16-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/32-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-extensions/icons/48-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/development.html: -------------------------------------------------------------------------------- 1 | 2 | 17 |

18 | This page is using the development build of React. 🚧 19 |

20 |

21 | Note that the development build is not suitable for production. 22 |
23 | Make sure to use the production build before deployment. 24 |

25 |
26 |

27 | Open the developer tools, and "Components" and "Profiler" tabs will appear to the right. 28 |

29 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/disabled.html: -------------------------------------------------------------------------------- 1 | 2 | 17 |

18 | This page doesn’t appear to be using React. 19 |
20 | If this seems wrong, follow the troubleshooting instructions. 21 |

22 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/outdated.html: -------------------------------------------------------------------------------- 1 | 2 | 17 |

18 | This page is using an outdated version of React. ⌛ 19 |

20 |

21 | We recommend updating React to ensure that you receive important bugfixes and performance improvements. 22 |
23 |
24 | You can find the upgrade instructions on the React blog. 25 |

26 |
27 |

28 | Open the developer tools, and "Components" and "Profiler" tabs will appear to the right. 29 |

30 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/production.html: -------------------------------------------------------------------------------- 1 | 2 | 17 |

18 | This page is using the production build of React. ✅ 19 |
20 | Open the developer tools, and "Components" and "Profiler" tabs will appear to the right. 21 |

22 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/shared.js: -------------------------------------------------------------------------------- 1 | /* globals chrome */ 2 | 3 | 'use strict'; 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | // Make links work 7 | const links = document.getElementsByTagName('a'); 8 | for (let i = 0; i < links.length; i++) { 9 | (function() { 10 | const ln = links[i]; 11 | const location = ln.href; 12 | ln.onclick = function() { 13 | chrome.tabs.create({active: true, url: location}); 14 | return false; 15 | }; 16 | })(); 17 | } 18 | 19 | // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=428044 20 | document.body.style.opacity = 0; 21 | document.body.style.transition = 'opacity ease-out .4s'; 22 | requestAnimationFrame(function() { 23 | document.body.style.opacity = 1; 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/popups/unminified.html: -------------------------------------------------------------------------------- 1 | 2 | 17 |

18 | This page is using an unminified build of React. 🚧 19 |

20 |

21 | The React build on this page appears to be unminified. 22 |
23 | This makes its size larger, and causes React to run slower. 24 |
25 |
26 | Make sure to set up minification before deployment. 27 |

28 |
29 |

30 | Open the developer tools, and "Components" and "Profiler" tabs will appear to the right. 31 |

32 | -------------------------------------------------------------------------------- /packages/react-devtools-extensions/src/panel.js: -------------------------------------------------------------------------------- 1 | // Portal target container. 2 | window.container = document.getElementById('container'); 3 | 4 | let hasInjectedStyles = false; 5 | 6 | // DevTools styles are injected into the top-level document head (where the main React app is rendered). 7 | // This method copies those styles to the child window where each panel (e.g. Elements, Profiler) is portaled. 8 | window.injectStyles = getLinkTags => { 9 | if (!hasInjectedStyles) { 10 | hasInjectedStyles = true; 11 | 12 | const linkTags = getLinkTags(); 13 | 14 | // eslint-disable-next-line no-for-of-loops/no-for-of-loops 15 | for (const linkTag of linkTags) { 16 | document.head.appendChild(linkTag); 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/react-devtools-inline/backend.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/backend'); 2 | -------------------------------------------------------------------------------- /packages/react-devtools-inline/frontend.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/frontend'); 2 | -------------------------------------------------------------------------------- /packages/react-devtools-inline/src/constants.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export const MESSAGE_TYPE_GET_SAVED_PREFERENCES = 4 | 'React::DevTools::getSavedPreferences'; 5 | export const MESSAGE_TYPE_SAVED_PREFERENCES = 6 | 'React::DevTools::savedPreferences'; 7 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/README.md: -------------------------------------------------------------------------------- 1 | # Experimental React Concurrent Mode Profiler 2 | 3 | https://react-devtools-scheduling-profiler.vercel.app/ 4 | 5 | ## Setting up continuous deployment with CircleCI and Vercel 6 | 7 | These instructions are intended for internal use, but may be useful if you are setting up a custom production deployment of the scheduling profiler. 8 | 9 | 1. Create a Vercel token at https://vercel.com/account/tokens. 10 | 2. Configure CircleCI: 11 | 1. In CircleCI, navigate to the repository's Project Settings. 12 | 2. In the Advanced tab, ensure that "Pass secrets to builds from forked pull requests" is set to false. 13 | 3. In the Environment Variables tab, add the Vercel token as a new `SCHEDULING_PROFILER_DEPLOY_VERCEL_TOKEN` environment variable. 14 | 15 | The Vercel project will be created when the deploy job runs. 16 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/App.css: -------------------------------------------------------------------------------- 1 | .DevTools { 2 | width: 100%; 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | background-color: var(--color-background); 7 | color: var(--color-text); 8 | } 9 | 10 | .TabContent { 11 | flex: 1 1 100%; 12 | overflow: auto; 13 | -webkit-app-region: no-drag; 14 | } 15 | 16 | .DevTools, .DevTools * { 17 | box-sizing: border-box; 18 | -webkit-font-smoothing: var(--font-smoothing); 19 | } 20 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/CanvasPage.css: -------------------------------------------------------------------------------- 1 | .CanvasPage { 2 | position: absolute; 3 | top: 0.5rem; 4 | bottom: 0.5rem; 5 | left: 0.5rem; 6 | right: 0.5rem; 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/ImportButton.css: -------------------------------------------------------------------------------- 1 | /** 2 | * https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications 3 | */ 4 | .Input { 5 | position: absolute !important; 6 | height: 1px; 7 | width: 1px; 8 | overflow: hidden; 9 | clip: rect(1px, 1px, 1px, 1px); 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/SchedulingProfilerFeatureFlags.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 enableDarkMode = false; 11 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/assets/profilerBrowser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools-scheduling-profiler/src/assets/profilerBrowser.png -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/constants.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 { 11 | COMFORTABLE_LINE_HEIGHT, 12 | COMPACT_LINE_HEIGHT, 13 | } from 'react-devtools-shared/src/constants.js'; 14 | 15 | export const REACT_TOTAL_NUM_LANES = 31; 16 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/content-views/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 | export * from './FlamechartView'; 11 | export * from './ReactEventsView'; 12 | export * from './ReactMeasuresView'; 13 | export * from './TimeAxisMarkersView'; 14 | export * from './UserTimingMarksView'; 15 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/context/ContextMenu.css: -------------------------------------------------------------------------------- 1 | .ContextMenu { 2 | position: absolute; 3 | border-radius: 0.125rem; 4 | background-color: #ffffff; 5 | border: 1px solid #ccc; 6 | box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); 7 | font-size: 11px; 8 | overflow: hidden; 9 | z-index: 10000002; 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/context/ContextMenuItem.css: -------------------------------------------------------------------------------- 1 | .ContextMenuItem { 2 | display: flex; 3 | align-items: center; 4 | color: #333; 5 | padding: 0.5rem 0.75rem; 6 | cursor: default; 7 | border-top: 1px solid #ccc; 8 | } 9 | .ContextMenuItem:first-of-type { 10 | border-top: none; 11 | } 12 | .ContextMenuItem:hover, 13 | .ContextMenuItem:focus { 14 | outline: 0; 15 | background-color: rgba(0, 136, 250, 0.1); 16 | } 17 | .ContextMenuItem:active { 18 | background-color: #0088fa; 19 | color: #fff; 20 | } 21 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/context/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 | import {RegistryContext} from './Contexts'; 11 | import ContextMenu from './ContextMenu'; 12 | import ContextMenuItem from './ContextMenuItem'; 13 | import useContextMenu from './useContextMenu'; 14 | 15 | export {RegistryContext, ContextMenu, ContextMenuItem, useContextMenu}; 16 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/import-worker/InvalidProfileError.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 | * An error thrown when an invalid profile could not be processed. 12 | */ 13 | export default class InvalidProfileError extends Error {} 14 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | height: 100%; 7 | margin: 0; 8 | font-family: var(--font-family-sans); 9 | font-size: var(--font-size-sans-normal); 10 | background-color: var(--color-background); 11 | color: var(--color-text); 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 16 | monospace; 17 | } 18 | 19 | .Container { 20 | height: 100%; 21 | } -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/view-base/constants.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 MOVE_WHEEL_DELTA_THRESHOLD = 1; 11 | export const ZOOM_WHEEL_DELTA_THRESHOLD = 1; 12 | export const MIN_ZOOM_LEVEL = 0.25; 13 | export const MAX_ZOOM_LEVEL = 1000; 14 | export const DEFAULT_ZOOM_LEVEL = 0.25; 15 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/view-base/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 | export * from './ColorView'; 11 | export * from './HorizontalPanAndZoomView'; 12 | export * from './ResizableSplitView'; 13 | export * from './Surface'; 14 | export * from './VerticalScrollView'; 15 | export * from './View'; 16 | export * from './geometry'; 17 | export * from './layouter'; 18 | export * from './useCanvasInteraction'; 19 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/src/view-base/utils/clamp.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 function clamp(min: number, max: number, value: number): number { 11 | if (Number.isNaN(min) || Number.isNaN(max) || Number.isNaN(value)) { 12 | throw new Error( 13 | `Clamp was called with NaN. Args: min: ${min}, max: ${max}, value: ${value}.`, 14 | ); 15 | } 16 | return Math.min(max, Math.max(min, value)); 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-devtools-scheduling-profiler/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools-scheduling-profiler" 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-devtools-shared", 4 | "version": "0.0.0", 5 | "devDependencies": { 6 | "react-15": "npm:react@^15", 7 | "react-dom-15": "npm:react-dom@^15" 8 | }, 9 | "dependencies": { 10 | "@babel/runtime": "^7.11.2", 11 | "@reach/menu-button": "^0.1.17", 12 | "@reach/tooltip": "^0.2.2", 13 | "clipboard-js": "^0.3.6", 14 | "json5": "^2.1.3", 15 | "local-storage-fallback": "^4.1.1", 16 | "lodash.throttle": "^4.1.1", 17 | "memoize-one": "^3.1.1", 18 | "react-virtualized-auto-sizer": "^1.0.2", 19 | "semver": "^6.3.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/__tests__/__mocks__/cssMock.js: -------------------------------------------------------------------------------- 1 | module.exports = {}; 2 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/__tests__/profilingUtils-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 | describe('profiling utils', () => { 11 | let utils; 12 | 13 | beforeEach(() => { 14 | utils = require('react-devtools-shared/src/devtools/views/Profiler/utils'); 15 | }); 16 | 17 | it('should throw if importing older/unsupported data', () => { 18 | expect(() => 19 | utils.prepareProfilingDataFrontendFromExport( 20 | ({ 21 | version: 0, 22 | dataForRoots: [], 23 | }: any), 24 | ), 25 | ).toThrow('Unsupported profiler export version "0"'); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/__tests__/setupEnv.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // DevTools stores preferences between sessions in localStorage 4 | if (!global.hasOwnProperty('localStorage')) { 5 | global.localStorage = require('local-storage-fallback').default; 6 | } 7 | 8 | // Mimic the global we set with Webpack's DefinePlugin 9 | global.__DEV__ = process.env.NODE_ENV !== 'production'; 10 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/__tests__/storeSerializer.js: -------------------------------------------------------------------------------- 1 | import {printStore} from 'react-devtools-shared/src/devtools/utils'; 2 | 3 | // test() is part of Jest's serializer API 4 | export function test(maybeStore) { 5 | // It's important to lazy-require the Store rather than imported at the head of the module. 6 | // Because we reset modules between tests, different Store implementations will be used for each test. 7 | // Unfortunately Jest does not reset its own serializer modules. 8 | return ( 9 | maybeStore instanceof 10 | require('react-devtools-shared/src/devtools/store').default 11 | ); 12 | } 13 | 14 | // print() is part of Jest's serializer API 15 | export function print(store, serialize, indent) { 16 | return printStore(store); 17 | } 18 | 19 | // Used for Jest snapshot testing. 20 | // May also be useful for visually debugging the tree, so it lives on the Store. 21 | export {printStore}; 22 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/backend/NativeStyleEditor/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 | 10 | export type BoxStyle = $ReadOnly<{| 11 | bottom: number, 12 | left: number, 13 | right: number, 14 | top: number, 15 | |}>; 16 | 17 | export type Layout = {| 18 | x: number, 19 | y: number, 20 | width: number, 21 | height: number, 22 | left: number, 23 | top: number, 24 | margin: BoxStyle, 25 | padding: BoxStyle, 26 | |}; 27 | 28 | export type Style = Object; 29 | 30 | export type StyleAndLayout = {| 31 | id: number, 32 | style: Style | null, 33 | layout: Layout | null, 34 | |}; 35 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.css: -------------------------------------------------------------------------------- 1 | .ContextMenu { 2 | position: absolute; 3 | background-color: var(--color-context-background); 4 | border-radius: 0.25rem; 5 | overflow: hidden; 6 | z-index: 10000002; 7 | } -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenuItem.css: -------------------------------------------------------------------------------- 1 | .ContextMenuItem { 2 | display: flex; 3 | align-items: center; 4 | color: var(--color-context-text); 5 | padding: 0.5rem 0.75rem; 6 | cursor: default; 7 | border-top: 1px solid var(--color-context-border); 8 | font-family: var(--font-family-sans); 9 | font-size: var(--font-size-sans-normal); 10 | } 11 | .ContextMenuItem:first-of-type { 12 | border-top: none; 13 | } 14 | .ContextMenuItem:hover, 15 | .ContextMenuItem:focus { 16 | outline: 0; 17 | background-color: var(--color-context-background-hover); 18 | } 19 | .ContextMenuItem:active { 20 | background-color: var(--color-context-background-selected); 21 | color: var(--color-context-text-selected); 22 | } -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/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 | import type {FrontendBridge} from 'react-devtools-shared/src/bridge'; 11 | 12 | type Shell = {| 13 | connect: (callback: Function) => void, 14 | onReload: (reloadFn: Function) => void, 15 | |}; 16 | 17 | export function initDevTools(shell: Shell) { 18 | shell.connect((bridge: FrontendBridge) => { 19 | // TODO ... 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Button.css: -------------------------------------------------------------------------------- 1 | .Button { 2 | border: none; 3 | background: var(--color-button-background); 4 | color: var(--color-button); 5 | padding: 0; 6 | border-radius: 0.25rem; 7 | flex: 0 0 auto; 8 | } 9 | .ButtonContent { 10 | display: inline-flex; 11 | align-items: center; 12 | border-radius: 0.25rem; 13 | padding: 0.25rem; 14 | } 15 | 16 | .Button:hover { 17 | color: var(--color-button-hover); 18 | } 19 | .Button:active { 20 | color: var(--color-button-focus); 21 | outline: none; 22 | } 23 | .Button:focus, 24 | .ButtonContent:focus { 25 | outline: none; 26 | } 27 | 28 | .Button:focus > .ButtonContent { 29 | background: var(--color-button-background-focus); 30 | } 31 | 32 | .Button:disabled, 33 | .Button:disabled:active { 34 | background: var(--color-button-background); 35 | color: var(--color-button-disabled); 36 | cursor: default; 37 | } 38 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/ButtonIcon.css: -------------------------------------------------------------------------------- 1 | .ButtonIcon { 2 | width: 1rem; 3 | height: 1rem; 4 | fill: currentColor; 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/Badge.css: -------------------------------------------------------------------------------- 1 | .Badge { 2 | display: inline-block; 3 | background-color: var(--color-component-badge-background); 4 | color: var(--color-text); 5 | padding: 0.125rem 0.25rem; 6 | line-height: normal; 7 | border-radius: 0.125rem; 8 | margin-right: 0.25rem; 9 | font-family: var(--font-family-monospace); 10 | font-size: var(--font-size-monospace-small); 11 | } 12 | 13 | .ExtraLabel { 14 | font-family: var(--font-family-monospace); 15 | font-size: var(--font-size-monospace-small); 16 | color: var(--color-component-badge-count); 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/EditableName.css: -------------------------------------------------------------------------------- 1 | .Input { 2 | flex: 0 1 auto; 3 | box-shadow: 0px 1px 3px transparent; 4 | color: var(--color-text); 5 | } 6 | .Input:focus { 7 | color: var(--color-text); 8 | box-shadow: 0px 1px 3px var(--color-shadow); 9 | } -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/ExpandCollapseToggle.css: -------------------------------------------------------------------------------- 1 | .ExpandCollapseToggle { 2 | flex: 0 0 1rem; 3 | width: 1rem; 4 | height: 1rem; 5 | padding: 0; 6 | color: var(--color-expand-collapse-toggle); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/HocBadges.css: -------------------------------------------------------------------------------- 1 | .HocBadges { 2 | padding: 0.125rem 0.25rem; 3 | user-select: none; 4 | } 5 | 6 | .Badge { 7 | display: inline-block; 8 | background-color: var(--color-component-badge-background); 9 | color: var(--color-text); 10 | padding: 0.125rem 0.25rem; 11 | line-height: normal; 12 | border-radius: 0.125rem; 13 | margin-right: 0.25rem; 14 | font-family: var(--font-family-monospace); 15 | font-size: var(--font-size-monospace-small); 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.css: -------------------------------------------------------------------------------- 1 | .Input { 2 | min-width: 0.5rem; 3 | flex: 1 1 auto; 4 | border: none; 5 | background: transparent; 6 | outline: none; 7 | padding: 0; 8 | border: none; 9 | font-family: var(--font-family-monospace); 10 | font-size: var(--font-size-monospace-normal); 11 | } 12 | 13 | .Input:focus { 14 | border-color: var(--color-border); 15 | } 16 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/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 | 10 | import type { 11 | Layout as LayoutBackend, 12 | Style as StyleBackend, 13 | } from 'react-devtools-shared/src/backend/NativeStyleEditor/types'; 14 | 15 | export type Layout = LayoutBackend; 16 | export type Style = StyleBackend; 17 | export type StyleAndLayout = {| 18 | layout: LayoutBackend | null, 19 | style: StyleBackend | null, 20 | |}; 21 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.css: -------------------------------------------------------------------------------- 1 | .NewArrayValue { 2 | white-space: nowrap; 3 | display: flex; 4 | align-items: center; 5 | } 6 | 7 | .EditableName { 8 | margin-left: 1rem; 9 | } 10 | 11 | .Invalid { 12 | background-color: var(--color-background-invalid); 13 | color: var(--color-text-invalid) !important; 14 | } 15 | 16 | .Input:focus, 17 | .Invalid:focus { 18 | background-color: var(--color-button-background-focus); 19 | } -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.css: -------------------------------------------------------------------------------- 1 | .NewKeyValue { 2 | white-space: nowrap; 3 | display: flex; 4 | align-items: center; 5 | } 6 | 7 | .EditableName { 8 | margin-left: 1rem; 9 | } 10 | 11 | .EditableValue { 12 | min-width: 1rem; 13 | } 14 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/SelectedTreeHighlight.css: -------------------------------------------------------------------------------- 1 | .Active, 2 | .Inactive { 3 | position: absolute; 4 | left: 0; 5 | width: 100%; 6 | z-index: 0; 7 | pointer-events: none; 8 | } 9 | 10 | .Active { 11 | background-color: var(--color-selected-tree-highlight-active); 12 | } 13 | 14 | .Inactive { 15 | background-color: var(--color-selected-tree-highlight-inactive); 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/TreeFocusedContext.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 {createContext} from 'react'; 11 | 12 | const TreeFocusedContext = createContext(false); 13 | 14 | export default TreeFocusedContext; 15 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/ViewElementSourceContext.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 {createContext} from 'react'; 11 | 12 | import type { 13 | CanViewElementSource, 14 | ViewElementSource, 15 | } from 'react-devtools-shared/src/devtools/views/DevTools'; 16 | 17 | export type Context = {| 18 | canViewElementSourceFunction: CanViewElementSource | null, 19 | viewElementSourceFunction: ViewElementSource | null, 20 | |}; 21 | 22 | const ViewElementSourceContext = createContext(((null: any): Context)); 23 | ViewElementSourceContext.displayName = 'ViewElementSourceContext'; 24 | 25 | export default ViewElementSourceContext; 26 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Components/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 | /** 11 | * Converts nested hooks paths to the format expected by the backend. 12 | * e.g. [''] => [''] 13 | * e.g. [1, 'value', ...] => [...] 14 | * e.g. [2, 'subhooks', 1, 'value', ...] => [...] 15 | * e.g. [1, 'subhooks', 3, 'subhooks', 2, 'value', ...] => [...] 16 | */ 17 | export function parseHookPathForEdit( 18 | path: Array, 19 | ): Array { 20 | let index = 0; 21 | for (let i = 0; i < path.length; i++) { 22 | if (path[i] === 'value') { 23 | index = i + 1; 24 | break; 25 | } 26 | } 27 | return path.slice(index); 28 | } 29 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Icon.css: -------------------------------------------------------------------------------- 1 | .Icon { 2 | width: 1rem; 3 | height: 1rem; 4 | fill: currentColor; 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/ChartNode.css: -------------------------------------------------------------------------------- 1 | .Group { 2 | transition: all ease-in-out 250ms; 3 | } 4 | 5 | .Rect { 6 | cursor: pointer; 7 | stroke: var(--color-background); 8 | transition: all ease-in-out 250ms; 9 | } 10 | 11 | .ForeignObject { 12 | pointer-events: none; 13 | transition: all ease-in-out 250ms; 14 | } 15 | 16 | .Div { 17 | pointer-events: none; 18 | white-space: nowrap; 19 | text-overflow: ellipsis; 20 | overflow: hidden; 21 | font-family: var(--font-family-sans); 22 | font-size: var(--font-size-sans-normal); 23 | margin-left: 0.25rem; 24 | margin-right: 0.25rem; 25 | line-height: 1.5; 26 | padding: 0 0 0; 27 | font-weight: 400; 28 | color: var(--color-commit-gradient-text); 29 | text-align: left; 30 | transition: all ease-in-out 250ms; 31 | } 32 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.css: -------------------------------------------------------------------------------- 1 | .Container { 2 | width: 100%; 3 | flex: 1; 4 | padding: 0.5rem; 5 | } 6 | 7 | .PatternPath { 8 | stroke: var(--color-commit-did-not-render-pattern); 9 | stroke-width: 1; 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/CommitRanked.css: -------------------------------------------------------------------------------- 1 | .Container { 2 | width: 100%; 3 | flex: 1; 4 | padding: 0.5rem; 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/HoveredFiberInfo.css: -------------------------------------------------------------------------------- 1 | .Toolbar { 2 | padding: 0.25rem 0; 3 | margin-bottom: 0.25rem; 4 | flex: 0 0 auto; 5 | display: flex; 6 | align-items: center; 7 | border-bottom: 1px solid var(--color-border); 8 | } 9 | 10 | .Content { 11 | user-select: none; 12 | overflow-y: auto; 13 | } 14 | 15 | .Component { 16 | flex: 1; 17 | font-weight: bold; 18 | font-family: var(--font-family-monospace); 19 | font-size: var(--font-size-monospace-normal); 20 | white-space: nowrap; 21 | overflow-x: hidden; 22 | text-overflow: ellipsis; 23 | } 24 | 25 | .Label { 26 | font-weight: bold; 27 | } 28 | 29 | .CurrentCommit { 30 | margin: 0.25rem 0; 31 | display: block; 32 | width: 100%; 33 | text-align: left; 34 | background: none; 35 | border: none; 36 | } 37 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/Interactions.css: -------------------------------------------------------------------------------- 1 | .Container { 2 | width: 100%; 3 | flex: 1; 4 | padding: 0.5rem; 5 | } 6 | 7 | .FocusTarget:focus { 8 | outline: none; 9 | } 10 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/NoCommitData.css: -------------------------------------------------------------------------------- 1 | .NoCommitData { 2 | width: 100%; 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: center; 8 | } 9 | 10 | .Header { 11 | font-size: var(--font-size-sans-large); 12 | margin-bottom: 0.5rem; 13 | } 14 | 15 | .FilterMessage { 16 | display: flex; 17 | align-items: center; 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/NoCommitData.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 * as React from 'react'; 11 | 12 | import styles from './NoCommitData.css'; 13 | 14 | export default function NoCommitData(_: {||}) { 15 | return ( 16 |
17 |
18 | There is no data matching the current filter criteria. 19 |
20 |
21 | Try adjusting the commit filter in Profiler settings. 22 |
23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/NoInteractions.css: -------------------------------------------------------------------------------- 1 | .NoInteractions { 2 | width: 100%; 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: center; 8 | } 9 | 10 | .Header { 11 | font-size: var(--font-size-sans-large); 12 | } 13 | 14 | .Link { 15 | color: var(--color-button); 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.css: -------------------------------------------------------------------------------- 1 | .VRule { 2 | height: 20px; 3 | width: 1px; 4 | border-left: 1px solid var(--color-border); 5 | padding-left: 0.25rem; 6 | margin-left: 0.25rem; 7 | } 8 | 9 | /** 10 | * https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications 11 | */ 12 | .Input { 13 | position: absolute !important; 14 | height: 1px; 15 | width: 1px; 16 | overflow: hidden; 17 | clip: rect(1px, 1px, 1px, 1px); 18 | } 19 | 20 | .ErrorMessage { 21 | margin: 0.5rem 0; 22 | color: var(--color-dim); 23 | font-family: var(--font-family-monospace); 24 | font-size: var(--font-size-monospace-normal); 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/RootSelector.css: -------------------------------------------------------------------------------- 1 | .Spacer { 2 | flex: 1; 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitList.css: -------------------------------------------------------------------------------- 1 | .List { 2 | /** 3 | * The decision to suppress the default (horizontal) scroll bars is intentional. 4 | * The snapshot selector is small enough that the scrollbar renders it essentially useless. 5 | * There are two alternative navigation mechanisms (arrow keys and arrow buttons). 6 | * If necessary, we could also expand the click-and-drag mechanism to scroll. 7 | */ 8 | overflow-x: hidden !important; 9 | } 10 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.css: -------------------------------------------------------------------------------- 1 | .Outer { 2 | user-select: none; 3 | cursor: pointer; 4 | border-bottom: 3px solid transparent; 5 | padding-top: 4px; 6 | padding-bottom: 1px; 7 | display: flex; 8 | align-items: flex-end; 9 | } 10 | 11 | .Inner { 12 | width: 100%; 13 | min-height: 5px; 14 | background-color: var(--color-commit-did-not-render-fill); 15 | color: var(--color-commit-did-not-render-fill-text); 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.css: -------------------------------------------------------------------------------- 1 | .Button { 2 | flex: 0 0 auto; 3 | margin-left: 0.25rem; 4 | } 5 | 6 | .Commits { 7 | height: 100%; 8 | min-width: 30px; 9 | margin-left: 0.25rem; 10 | overflow: hidden; 11 | } 12 | .Commits:focus { 13 | outline: none; 14 | background-color: var(--color-button-background-focus); 15 | } 16 | 17 | .IndexLabel { 18 | flex: 0 0 auto; 19 | white-space: nowrap; 20 | font-family: var(--font-family-monospace); 21 | margin-left: 0.25rem; 22 | } 23 | 24 | .NoCommits { 25 | height: 100%; 26 | display: flex; 27 | align-items: center; 28 | justify-content: center; 29 | color: var(--color-dim); 30 | } 31 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/Tooltip.css: -------------------------------------------------------------------------------- 1 | .Tooltip { 2 | position: absolute; 3 | pointer-events: none; 4 | border: none; 5 | border-radius: 0.25rem; 6 | padding: 0.25rem 0.5rem; 7 | font-family: var(--font-family-sans); 8 | font-size: 12px; 9 | background-color: var(--color-tooltip-background); 10 | color: var(--color-tooltip-text); 11 | opacity: 1; 12 | /* Make sure this is above the DevTools, which are above the Overlay */ 13 | z-index: 10000002; 14 | } 15 | 16 | .Tooltip.hidden { 17 | opacity: 0; 18 | } 19 | 20 | 21 | .Container { 22 | width: -moz-max-content; 23 | width: -webkit-max-content; 24 | } 25 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/WhatChanged.css: -------------------------------------------------------------------------------- 1 | .Component { 2 | margin-bottom: 0.5rem; 3 | } 4 | 5 | .Item { 6 | margin-top: 0.25rem; 7 | } 8 | 9 | .Key { 10 | font-family: var(--font-family-monospace); 11 | font-size: var(--font-size-monospace-small); 12 | line-height: 1; 13 | } 14 | 15 | .Key:first-of-type::before { 16 | content: ' ('; 17 | } 18 | 19 | .Key::after { 20 | content: ', '; 21 | } 22 | 23 | .Key:last-of-type::after { 24 | content: ')'; 25 | } 26 | 27 | .Label { 28 | font-weight: bold; 29 | } 30 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/constants.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 barWidthThreshold = 2; 11 | export const interactionCommitSize = 10; 12 | export const interactionLabelWidth = 200; 13 | export const maxBarWidth = 30; 14 | export const minBarWidth = 5; 15 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/ReactLogo.css: -------------------------------------------------------------------------------- 1 | .ReactLogo { 2 | width: 1.75rem; 3 | height: 1.75rem; 4 | margin: 0 0.75rem 0 0.25rem; 5 | color: var(--color-button-active); 6 | } 7 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Tooltip.css: -------------------------------------------------------------------------------- 1 | .Tooltip { 2 | border: none; 3 | border-radius: 0.25rem; 4 | padding: 0.25rem 0.5rem; 5 | font-family: var(--font-family-sans); 6 | font-size: 12px; 7 | background-color: var(--color-tooltip-background); 8 | color: var(--color-tooltip-text); 9 | 10 | /* Make sure this is above the DevTools, which are above the Overlay */ 11 | z-index: 10000002; 12 | } 13 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.css: -------------------------------------------------------------------------------- 1 | .Row { 2 | display: flex; 3 | flex-direction: row; 4 | align-items: center; 5 | } 6 | 7 | .Column { 8 | display: flex; 9 | flex-direction: column; 10 | align-items: center; 11 | } 12 | 13 | .Title { 14 | font-size: var(--font-size-sans-large); 15 | margin-bottom: 0.5rem; 16 | } 17 | 18 | .ReleaseNotesLink { 19 | color: var(--color-button-active); 20 | } -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/WarnIfLegacyBackendDetected.css: -------------------------------------------------------------------------------- 1 | .Command { 2 | background-color: var(--color-dimmest); 3 | padding: 0.25rem 0.5rem; 4 | display: block; 5 | border-radius: 0.125rem; 6 | } 7 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/README.md: -------------------------------------------------------------------------------- 1 | Harness for testing local changes to the `react-devtools-inline` and `react-devtools-shared` packages. 2 | 3 | ## Development 4 | 5 | This target should be run in parallel with the `react-devtools-inline` package. The first step then is to run that target following the instructions in the [`react-devtools-inline` README](https://github.com/facebook/react/blob/master/packages/react-devtools-inline/README.md). 6 | 7 | The test harness can then be run as follows: 8 | ```sh 9 | cd packages/react-devtools-shell 10 | 11 | yarn start 12 | ``` 13 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools-experimental", 3 | "alias": ["react-devtools-experimental"], 4 | "files": ["index.html", "dist"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/InspectableElements/CircularReferences.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 * as React from 'react'; 11 | 12 | const arrayOne = []; 13 | const arrayTwo = []; 14 | arrayTwo.push(arrayOne); 15 | arrayOne.push(arrayTwo); 16 | 17 | const objectOne = {}; 18 | const objectTwo = {objectOne}; 19 | objectOne.objectTwo = objectTwo; 20 | 21 | export default function CircularReferences() { 22 | return ; 23 | } 24 | 25 | function ChildComponent(props: any) { 26 | return null; 27 | } 28 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/InspectableElements/CustomObject.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 * as React from 'react'; 11 | 12 | class Custom { 13 | _number = 42; 14 | get number() { 15 | return this._number; 16 | } 17 | } 18 | 19 | export default function CustomObject() { 20 | return ; 21 | } 22 | 23 | function ChildComponent(props: any) { 24 | return null; 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/InspectableElements/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 | import InspectableElements from './InspectableElements'; 11 | 12 | export default InspectableElements; 13 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/ToDoList/List.css: -------------------------------------------------------------------------------- 1 | .Input { 2 | font-size: 1rem; 3 | padding: 0.25rem; 4 | } 5 | 6 | .IconButton { 7 | padding: 0.25rem; 8 | border: none; 9 | background: none; 10 | cursor: pointer; 11 | } 12 | 13 | .List { 14 | margin: 0.5rem 0 0; 15 | padding: 0; 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/ToDoList/ListItem.css: -------------------------------------------------------------------------------- 1 | .ListItem { 2 | list-style-type: none; 3 | } 4 | 5 | .Input { 6 | cursor: pointer; 7 | } 8 | 9 | .Label { 10 | cursor: pointer; 11 | padding: 0.25rem; 12 | color: #555; 13 | } 14 | .Label:hover { 15 | color: #000; 16 | } 17 | 18 | .IconButton { 19 | padding: 0.25rem; 20 | border: none; 21 | background: none; 22 | cursor: pointer; 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/ToDoList/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 | import List from './List'; 11 | 12 | export default List; 13 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/Toggle/index.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {useState} from 'react'; 3 | 4 | export default function Toggle() { 5 | const [show, setShow] = useState(false); 6 | return ( 7 | <> 8 |

Toggle

9 |
10 | <> 11 | 12 | {show && ' '} 13 | {show && Hello} 14 | 15 |
16 | 17 | ); 18 | } 19 | 20 | function Greeting({children}) { 21 | return

{children}

; 22 | } 23 | -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | /* GitHub.com frontend fonts */ 3 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, 4 | sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; 5 | font-size: 14px; 6 | line-height: 1.5; 7 | } 8 | 9 | h1 { 10 | font-size: 1.5rem; 11 | font-weight: bold; 12 | margin-bottom: 0.5rem; 13 | } 14 | -------------------------------------------------------------------------------- /packages/react-devtools/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | */ 11 | 12 | const electron = require('electron'); 13 | const spawn = require('cross-spawn'); 14 | const argv = process.argv.slice(2); 15 | const pkg = require('./package.json'); 16 | const updateNotifier = require('update-notifier'); 17 | 18 | // notify if there's an update 19 | updateNotifier({pkg}).notify({defer: false}); 20 | 21 | const result = spawn.sync(electron, [require.resolve('./app')].concat(argv), { 22 | stdio: 'ignore', 23 | }); 24 | 25 | process.exit(result.status); 26 | -------------------------------------------------------------------------------- /packages/react-devtools/icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/packages/react-devtools/icons/icon128.png -------------------------------------------------------------------------------- /packages/react-devtools/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 | const {connectToDevTools} = require('react-devtools-core/backend'); 11 | 12 | // Connect immediately with default options. 13 | // If you need more control, use `react-devtools-core` directly instead of `react-devtools`. 14 | connectToDevTools(); 15 | -------------------------------------------------------------------------------- /packages/react-devtools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-devtools", 3 | "version": "4.8.2", 4 | "description": "Use react-devtools outside of the browser", 5 | "license": "MIT", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/facebook/react.git", 9 | "directory": "packages/react-devtools" 10 | }, 11 | "bin": { 12 | "react-devtools": "./bin.js" 13 | }, 14 | "files": [ 15 | "bin.js", 16 | "build-info.json", 17 | "app.html", 18 | "app.js", 19 | "index.js", 20 | "icons" 21 | ], 22 | "scripts": { 23 | "start": "node bin.js" 24 | }, 25 | "dependencies": { 26 | "cross-spawn": "^5.0.1", 27 | "electron": "^9.1.0", 28 | "ip": "^1.1.4", 29 | "minimist": "^1.2.3", 30 | "react-devtools-core": "4.8.2", 31 | "update-notifier": "^2.1.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/react-dom/index.modern.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 | * @flow 8 | */ 9 | 10 | export { 11 | createPortal, 12 | unstable_batchedUpdates, 13 | flushSync, 14 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 15 | version, 16 | createRoot, 17 | createRoot as unstable_createRoot, 18 | createBlockingRoot, 19 | createBlockingRoot as unstable_createBlockingRoot, 20 | unstable_flushControlled, 21 | unstable_scheduleHydration, 22 | unstable_runWithPriority, 23 | unstable_createEventHandle, 24 | unstable_isNewReconciler, 25 | } from './src/client/ReactDOM'; 26 | -------------------------------------------------------------------------------- /packages/react-dom/index.stable.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 { 11 | createPortal, 12 | unstable_batchedUpdates, 13 | flushSync, 14 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 15 | version, 16 | findDOMNode, 17 | hydrate, 18 | render, 19 | unmountComponentAtNode, 20 | unstable_renderSubtreeIntoContainer, 21 | // Temporary alias since we already shipped React 16 RC with it. 22 | // TODO: remove in React 18. 23 | unstable_createPortal, 24 | } from './src/client/ReactDOM'; 25 | -------------------------------------------------------------------------------- /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/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 | export { 11 | renderToString, 12 | renderToStaticMarkup, 13 | renderToNodeStream, 14 | renderToStaticNodeStream, 15 | version, 16 | } from './src/server/ReactDOMServerBrowser'; 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 | export * from './server.node'; 11 | -------------------------------------------------------------------------------- /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 | // For some reason Flow doesn't like export * in this file. I don't know why. 11 | export { 12 | renderToString, 13 | renderToStaticMarkup, 14 | renderToNodeStream, 15 | renderToStaticNodeStream, 16 | version, 17 | } from './src/server/ReactDOMServerNode'; 18 | -------------------------------------------------------------------------------- /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/PluginModuleType.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 AnyNativeEvent = Event | KeyboardEvent | MouseEvent | TouchEvent; 11 | 12 | export type PluginName = string; 13 | 14 | export type EventSystemFlags = number; 15 | -------------------------------------------------------------------------------- /packages/react-dom/src/server/ReactDOMFizzServerBrowser.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 {ReactNodeList} from 'shared/ReactTypes'; 11 | 12 | import { 13 | createRequest, 14 | startWork, 15 | startFlowing, 16 | } from 'react-server/src/ReactFizzServer'; 17 | 18 | function renderToReadableStream(children: ReactNodeList): ReadableStream { 19 | let request; 20 | return new ReadableStream({ 21 | start(controller) { 22 | request = createRequest(children, controller); 23 | startWork(request); 24 | }, 25 | pull(controller) { 26 | startFlowing(request); 27 | }, 28 | cancel(reason) {}, 29 | }); 30 | } 31 | 32 | export {renderToReadableStream}; 33 | -------------------------------------------------------------------------------- /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 | export { 17 | renderToString, 18 | renderToStaticMarkup, 19 | renderToNodeStream, 20 | renderToStaticNodeStream, 21 | ReactVersion as version, 22 | }; 23 | -------------------------------------------------------------------------------- /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 * as 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 list 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 | export * from './src/test-utils/ReactTestUtils'; 11 | -------------------------------------------------------------------------------- /packages/react-dom/testing.classic.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 | * @flow 8 | */ 9 | 10 | export * from './index.classic.fb.js'; 11 | export { 12 | act, 13 | createComponentSelector, 14 | createHasPsuedoClassSelector, 15 | createRoleSelector, 16 | createTestNameSelector, 17 | createTextSelector, 18 | getFindAllNodesFailureDescription, 19 | findAllNodes, 20 | findBoundingRects, 21 | focusWithin, 22 | observeVisibleRects, 23 | } from 'react-reconciler/src/ReactFiberReconciler'; 24 | -------------------------------------------------------------------------------- /packages/react-dom/testing.experimental.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 './index.experimental.js'; 11 | export {act} from 'react-reconciler/src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /packages/react-dom/testing.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 './index.js'; 11 | export { 12 | act, 13 | createComponentSelector, 14 | createHasPsuedoClassSelector, 15 | createRoleSelector, 16 | createTestNameSelector, 17 | createTextSelector, 18 | getFindAllNodesFailureDescription, 19 | findAllNodes, 20 | findBoundingRects, 21 | focusWithin, 22 | observeVisibleRects, 23 | } from 'react-reconciler/src/ReactFiberReconciler'; 24 | -------------------------------------------------------------------------------- /packages/react-dom/testing.modern.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 | * @flow 8 | */ 9 | 10 | export * from './index.modern.fb.js'; 11 | export { 12 | act, 13 | createComponentSelector, 14 | createHasPsuedoClassSelector, 15 | createRoleSelector, 16 | createTestNameSelector, 17 | createTextSelector, 18 | getFindAllNodesFailureDescription, 19 | findAllNodes, 20 | findBoundingRects, 21 | focusWithin, 22 | observeVisibleRects, 23 | } from 'react-reconciler/src/ReactFiberReconciler'; 24 | -------------------------------------------------------------------------------- /packages/react-dom/testing.stable.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 './index.stable.js'; 11 | export {act} from 'react-reconciler/src/ReactFiberReconciler'; 12 | -------------------------------------------------------------------------------- /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 | export * from './src/server/ReactDOMFizzServerBrowser'; 11 | -------------------------------------------------------------------------------- /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 | export * from './unstable-fizz.node'; 11 | -------------------------------------------------------------------------------- /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 | export * from './src/server/ReactDOMFizzServerNode'; 11 | -------------------------------------------------------------------------------- /packages/react-fetch/README.md: -------------------------------------------------------------------------------- 1 | # react-fetch 2 | 3 | This package is meant to be used alongside yet-to-be-released, experimental React features. It's unlikely to be useful in any other context. 4 | 5 | **Do not use in a real application.** We're publishing this early for 6 | demonstration purposes. 7 | 8 | **Use it at your own risk.** 9 | 10 | # No, Really, It Is Unstable 11 | 12 | The API ~~may~~ will change wildly between versions. 13 | -------------------------------------------------------------------------------- /packages/react-fetch/index.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 | export * from './src/ReactFetchBrowser'; 13 | -------------------------------------------------------------------------------- /packages/react-fetch/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 './index.node'; 13 | -------------------------------------------------------------------------------- /packages/react-fetch/index.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 | export * from './src/ReactFetchNode'; 13 | -------------------------------------------------------------------------------- /packages/react-fetch/npm/index.browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-fetch.browser.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-fetch.browser.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-fetch/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./index.node'); 4 | -------------------------------------------------------------------------------- /packages/react-fetch/npm/index.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-fetch.node.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-fetch.node.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-fetch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-fetch", 4 | "description": "Helpers for creating React data sources", 5 | "version": "0.0.0", 6 | "repository": { 7 | "type" : "git", 8 | "url" : "https://github.com/facebook/react.git", 9 | "directory": "packages/react-fetch" 10 | }, 11 | "files": [ 12 | "LICENSE", 13 | "README.md", 14 | "build-info.json", 15 | "index.js", 16 | "index.node.js", 17 | "index.browser.js", 18 | "cjs/" 19 | ], 20 | "peerDependencies": { 21 | "react": "^17.0.0" 22 | }, 23 | "browser": { 24 | "./index.js": "./index.browser.js" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/react-fetch/src/__tests__/ReactFetchBrowser-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 | */ 9 | 10 | 'use strict'; 11 | 12 | describe('ReactFetchBrowser', () => { 13 | let ReactFetchBrowser; 14 | 15 | beforeEach(() => { 16 | if (__EXPERIMENTAL__) { 17 | ReactFetchBrowser = require('react-fetch'); 18 | } 19 | }); 20 | 21 | // TODO: test something useful. 22 | // @gate experimental 23 | it('exports something', () => { 24 | expect(ReactFetchBrowser.fetch).not.toBe(undefined); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/react-interactions/README.md: -------------------------------------------------------------------------------- 1 | # `react-interactions` 2 | 3 | This package is experimental. It is intended for use with the experimental React 4 | flags for internal testing. -------------------------------------------------------------------------------- /packages/react-interactions/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 | export * from './src/dom/create-event-handle/Focus'; 11 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/drag.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/drag.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/drag.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/focus.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/focus.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/focus.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/hover.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/hover.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/hover.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/input.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/input.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/press-legacy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/press-legacy.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/press-legacy.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/press.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/press.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/press.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/scroll.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/scroll.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/scroll.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/swipe.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/swipe.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/swipe.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-interactions/npm/tap.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-interactions-events/tap.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-interactions-events/tap.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /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": "17.0.0", 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 | import type {ReactFabricType} from './src/ReactNativeTypes'; 11 | import * as ReactFabric from './src/ReactFabric'; 12 | // Assert that the exports line up with the type we're going to expose. 13 | // eslint-disable-next-line no-unused-expressions 14 | (ReactFabric: ReactFabricType); 15 | 16 | export * from './src/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 | import type {ReactNativeType} from './src/ReactNativeTypes'; 11 | import * as ReactNative from './src/ReactNativeRenderer'; 12 | // Assert that the exports line up with the type we're going to expose. 13 | // eslint-disable-next-line no-unused-expressions 14 | (ReactNative: ReactNativeType); 15 | 16 | export * from './src/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 | "scheduler": "^0.11.0" 13 | }, 14 | "peerDependencies": { 15 | "react": "^17.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'; 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 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'; 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__/react-native/Libraries/ReactPrivate/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__/react-native/Libraries/ReactPrivate/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__/react-native/Libraries/ReactPrivate/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__/react-native/Libraries/ReactPrivate/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__/react-native/Libraries/ReactPrivate/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 strict 8 | */ 9 | 10 | module.exports = { 11 | showErrorDialog: jest.fn(), 12 | }; 13 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.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 strict 8 | */ 9 | 10 | 'use strict'; 11 | 12 | // Noop 13 | 14 | // TODO #10932517: Move all initialization callers back into react-native 15 | 16 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/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 | blurTextInput: jest.fn(), 15 | focusTextInput: jest.fn(), 16 | }; 17 | 18 | module.exports = TextInputState; 19 | -------------------------------------------------------------------------------- /packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/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__/react-native/Libraries/ReactPrivate/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-native-renderer/src/legacy-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/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/flight-client.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 './src/ReactNoopFlightClient'; 11 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/flight-modules.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 file is used as temporary storage for modules generated in Flight tests. 11 | let moduleIdx = 0; 12 | const modules: Map = new Map(); 13 | 14 | // This simulates what the compiler will do when it replaces render functions with server blocks. 15 | export function saveModule(render: Function): string { 16 | const idx = '' + moduleIdx++; 17 | modules.set(idx, render); 18 | return idx; 19 | } 20 | 21 | export function readModule(idx: string): Function { 22 | return modules.get(idx); 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/flight-server-runtime.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-server/flight-server-runtime'; 11 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/flight-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 | export * from './src/ReactNoopFlightServer'; 11 | -------------------------------------------------------------------------------- /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 | export * from './src/ReactNoop'; 11 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/flight-client.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-noop-renderer-flight-client.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer-flight-client.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/flight-modules.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // This file is used as temporary storage for modules generated in Flight tests. 4 | var moduleIdx = 0; 5 | var modules = new Map(); 6 | 7 | // This simulates what the compiler will do when it replaces render functions with server blocks. 8 | exports.saveModule = function saveModule(render) { 9 | var idx = '' + moduleIdx++; 10 | modules.set(idx, render); 11 | return idx; 12 | }; 13 | 14 | exports.readModule = function readModule(idx) { 15 | return modules.get(idx); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/flight-server-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('react-server/flight-server-runtime'); 4 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/flight-server.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-noop-renderer-flight-server.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer-flight-server.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-noop-renderer.production.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/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 | export * from './src/ReactNoopPersistent'; 11 | -------------------------------------------------------------------------------- /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 | export * from './src/ReactNoopServer'; 11 | -------------------------------------------------------------------------------- /packages/react-reconciler/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 | export * from './src/ReactFiberReconciler'; 11 | -------------------------------------------------------------------------------- /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/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/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/MaxInts.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 const MAX_SIGNED_31_BIT_INT = 1073741823; 14 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactCapturedValue.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 './ReactInternalTypes'; 11 | 12 | import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack'; 13 | 14 | export type CapturedValue = {| 15 | value: T, 16 | source: Fiber | null, 17 | stack: string | null, 18 | |}; 19 | 20 | export function createCapturedValue( 21 | value: T, 22 | source: Fiber, 23 | ): CapturedValue { 24 | // If the value is an error, call this function immediately after it is thrown 25 | // so the stack is accurate. 26 | return { 27 | value, 28 | source, 29 | stack: getStackByFiberInDevAndProd(source), 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /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 {Fiber} from './ReactInternalTypes'; 11 | import type {CapturedValue} from './ReactCapturedValue'; 12 | 13 | // This module is forked in different environments. 14 | // By default, return `true` to log errors to the console. 15 | // Forks can return `false` if this isn't desirable. 16 | 17 | export function showErrorDialog( 18 | boundary: Fiber, 19 | errorInfo: CapturedValue, 20 | ): boolean { 21 | return true; 22 | } 23 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberFundamental.new.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 './ReactInternalTypes'; 11 | import type { 12 | ReactFundamentalImpl, 13 | ReactFundamentalComponentInstance, 14 | } from 'shared/ReactTypes'; 15 | 16 | export function createFundamentalStateInstance( 17 | currentFiber: Fiber, 18 | props: Object, 19 | impl: ReactFundamentalImpl, 20 | state: Object, 21 | ): ReactFundamentalComponentInstance { 22 | return { 23 | currentFiber, 24 | impl, 25 | instance: null, 26 | prevProps: null, 27 | props, 28 | state, 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberFundamental.old.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 './ReactInternalTypes'; 11 | import type { 12 | ReactFundamentalImpl, 13 | ReactFundamentalComponentInstance, 14 | } from 'shared/ReactTypes'; 15 | 16 | export function createFundamentalStateInstance( 17 | currentFiber: Fiber, 18 | props: Object, 19 | impl: ReactFundamentalImpl, 20 | state: Object, 21 | ): ReactFundamentalComponentInstance { 22 | return { 23 | currentFiber, 24 | impl, 25 | instance: null, 26 | prevProps: null, 27 | props, 28 | state, 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /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 | /* eslint-disable react-internal/invariant-args */ 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // We expect that our Rollup, Jest, and Flow configurations 15 | // always shim this module with the corresponding host config 16 | // (either provided by a renderer, or a generic shim for npm). 17 | // 18 | // We should never resolve to this file, but it exists to make 19 | // sure that if we *do* accidentally break the configuration, 20 | // the failure isn't silent. 21 | 22 | // invariant(false, 'This module must be shimmed by a specific renderer.'); 23 | export * from './forks/ReactFiberHostConfig.dom' -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberHostConfigWithNoScopes.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 | // Renderers that don't support React Scopes 13 | // can re-export everything from this module. 14 | 15 | function shim(...args: any) { 16 | invariant( 17 | false, 18 | 'The current renderer does not support React Scopes. ' + 19 | 'This error is likely caused by a bug in React. ' + 20 | 'Please file an issue.', 21 | ); 22 | } 23 | 24 | // React Scopes (when unsupported) 25 | export const prepareScopeUpdate = shim; 26 | export const getInstanceFromScope = shim; 27 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberLazyComponent.new.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 function resolveDefaultProps(Component: any, baseProps: Object): Object { 11 | if (Component && Component.defaultProps) { 12 | // Resolve default props. Taken from ReactElement 13 | const props = Object.assign({}, baseProps); 14 | const defaultProps = Component.defaultProps; 15 | for (const propName in defaultProps) { 16 | if (props[propName] === undefined) { 17 | props[propName] = defaultProps[propName]; 18 | } 19 | } 20 | return props; 21 | } 22 | return baseProps; 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberLazyComponent.old.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 function resolveDefaultProps(Component: any, baseProps: Object): Object { 11 | if (Component && Component.defaultProps) { 12 | // Resolve default props. Taken from ReactElement 13 | const props = Object.assign({}, baseProps); 14 | const defaultProps = Component.defaultProps; 15 | for (const propName in defaultProps) { 16 | if (props[propName] === undefined) { 17 | props[propName] = defaultProps[propName]; 18 | } 19 | } 20 | return props; 21 | } 22 | return baseProps; 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactFiberTransition.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 ReactSharedInternals from 'shared/ReactSharedInternals'; 11 | 12 | const {ReactCurrentBatchConfig} = ReactSharedInternals; 13 | 14 | export const NoTransition = 0; 15 | 16 | export function requestCurrentTransition(): number { 17 | return ReactCurrentBatchConfig.transition; 18 | } 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 HookFlags = number; 11 | 12 | export const NoFlags = /* */ 0b000; 13 | 14 | // Represents whether effect should fire. 15 | export const HasEffect = /* */ 0b001; 16 | 17 | // Represents the phase in which the effect (not the clean-up) fires. 18 | export const Layout = /* */ 0b010; 19 | export const Passive = /* */ 0b100; 20 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactPortal.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_PORTAL_TYPE} from 'shared/ReactSymbols'; 11 | 12 | import type {ReactNodeList, ReactPortal} from 'shared/ReactTypes'; 13 | 14 | export function createPortal( 15 | children: ReactNodeList, 16 | containerInfo: any, 17 | // TODO: figure out the API for cross-renderer implementation. 18 | implementation: any, 19 | key: ?string = null, 20 | ): ReactPortal { 21 | return { 22 | // This tag allow us to uniquely identify this as a React Portal 23 | $$typeof: REACT_PORTAL_TYPE, 24 | key: key == null ? null : '' + key, 25 | children, 26 | containerInfo, 27 | implementation, 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /packages/react-reconciler/src/ReactRootTags.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 RootTag = 0 | 1 | 2; 11 | 12 | export const LegacyRoot = 0; 13 | export const BlockingRoot = 1; 14 | export const ConcurrentRoot = 2; 15 | -------------------------------------------------------------------------------- /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 NoMode = 0b00000; 13 | export const StrictMode = 0b00001; 14 | // TODO: Remove BlockingMode and ConcurrentMode by reading from the root 15 | // tag instead 16 | export const BlockingMode = 0b00010; 17 | export const ConcurrentMode = 0b00100; 18 | export const ProfileMode = 0b01000; 19 | export const DebugTracingMode = 0b10000; 20 | -------------------------------------------------------------------------------- /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/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-relay.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.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-refresh/README.md: -------------------------------------------------------------------------------- 1 | # react-refresh 2 | 3 | This package implements the wiring necessary to integrate Fast Refresh into bundlers. Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to an old feature known as "hot reloading", but Fast Refresh is more reliable and officially supported by React. 4 | 5 | This package is primarily aimed at developers of bundler plugins. If you’re working on one, here is a [rough guide](https://github.com/facebook/react/issues/16604#issuecomment-528663101) for Fast Refresh integration using this package. 6 | -------------------------------------------------------------------------------- /packages/react-refresh/babel.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} from './src/ReactFreshBabelPlugin'; 9 | -------------------------------------------------------------------------------- /packages/react-refresh/npm/babel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-refresh-babel.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-refresh-babel.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-refresh/npm/runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-refresh-runtime.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-refresh-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-refresh/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-refresh", 3 | "description": "React is a JavaScript library for building user interfaces.", 4 | "keywords": [ 5 | "react" 6 | ], 7 | "version": "0.9.0", 8 | "homepage": "https://reactjs.org/", 9 | "bugs": "https://github.com/facebook/react/issues", 10 | "license": "MIT", 11 | "files": [ 12 | "LICENSE", 13 | "README.md", 14 | "babel.js", 15 | "runtime.js", 16 | "build-info.json", 17 | "cjs/", 18 | "umd/" 19 | ], 20 | "main": "runtime.js", 21 | "repository": { 22 | "type": "git", 23 | "url": "https://github.com/facebook/react.git", 24 | "directory": "packages/react" 25 | }, 26 | "engines": { 27 | "node": ">=0.10.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/react-refresh/runtime.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 * from './src/ReactFreshRuntime'; 9 | -------------------------------------------------------------------------------- /packages/react-server/README.md: -------------------------------------------------------------------------------- 1 | # react-server 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 | -------------------------------------------------------------------------------- /packages/react-server/flight-server-runtime.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 './src/ReactFlightServerRuntime'; 11 | -------------------------------------------------------------------------------- /packages/react-server/flight.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 './src/ReactFlightServer'; 11 | -------------------------------------------------------------------------------- /packages/react-server/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 | export * from './src/ReactFizzServer'; 11 | -------------------------------------------------------------------------------- /packages/react-server/npm/flight-server-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-server-flight-server-runtime.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-server-flight-server-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-server/npm/flight.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-server-flight.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-server-flight.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-server/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-server.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-server.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-server/src/ReactDOMServerFormatConfig.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-server/src/ReactServerStreamConfig'; 11 | 12 | export function formatChunkAsString(type: string, props: Object): string { 13 | let str = '<' + type + '>'; 14 | if (typeof props.children === 'string') { 15 | str += props.children; 16 | } 17 | str += ''; 18 | return str; 19 | } 20 | 21 | export function formatChunk(type: string, props: Object): Uint8Array { 22 | return convertStringToBuffer(formatChunkAsString(type, props)); 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-server/src/ReactFlightServerBundlerConfigCustom.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 | declare var $$$hostConfig: any; 11 | 12 | export opaque type BundlerConfig = mixed; // eslint-disable-line no-undef 13 | export opaque type ModuleReference = mixed; // eslint-disable-line no-undef 14 | export opaque type ModuleMetaData: any = mixed; // eslint-disable-line no-undef 15 | export const resolveModuleMetaData = $$$hostConfig.resolveModuleMetaData; 16 | -------------------------------------------------------------------------------- /packages/react-server/src/ReactFlightServerConfig.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 | /* eslint-disable react-internal/invariant-args */ 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // We expect that our Rollup, Jest, and Flow configurations 15 | // always shim this module with the corresponding host config 16 | // (either provided by a renderer, or a generic shim for npm). 17 | // 18 | // We should never resolve to this file, but it exists to make 19 | // sure that if we *do* accidentally break the configuration, 20 | // the failure isn't silent. 21 | 22 | invariant(false, 'This module must be shimmed by a specific renderer.'); 23 | -------------------------------------------------------------------------------- /packages/react-server/src/ReactServerFormatConfig.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 | /* eslint-disable react-internal/invariant-args */ 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // We expect that our Rollup, Jest, and Flow configurations 15 | // always shim this module with the corresponding host config 16 | // (either provided by a renderer, or a generic shim for npm). 17 | // 18 | // We should never resolve to this file, but it exists to make 19 | // sure that if we *do* accidentally break the configuration, 20 | // the failure isn't silent. 21 | 22 | invariant(false, 'This module must be shimmed by a specific renderer.'); 23 | -------------------------------------------------------------------------------- /packages/react-server/src/ReactServerStreamConfig.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 | /* eslint-disable react-internal/invariant-args */ 11 | 12 | import invariant from 'shared/invariant'; 13 | 14 | // We expect that our Rollup, Jest, and Flow configurations 15 | // always shim this module with the corresponding host config 16 | // (either provided by a renderer, or a generic shim for npm). 17 | // 18 | // We should never resolve to this file, but it exists to make 19 | // sure that if we *do* accidentally break the configuration, 20 | // the failure isn't silent. 21 | 22 | invariant(false, 'This module must be shimmed by a specific renderer.'); 23 | -------------------------------------------------------------------------------- /packages/react-server/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 | const result = ReactNoopServer.render(
hello world
); 26 | expect(result).toEqual([{type: 'div', props: {children: 'hello world'}}]); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactFlightServerConfig.custom.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 '../ReactFlightServerConfigStream'; 11 | export * from '../ReactFlightServerBundlerConfigCustom'; 12 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactFlightServerConfig.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 '../ReactFlightServerConfigStream'; 11 | export * from 'react-transport-dom-webpack/src/ReactFlightServerWebpackBundlerConfig'; 12 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactFlightServerConfig.dom-relay.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-transport-dom-relay/src/ReactFlightDOMRelayServerHostConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactFlightServerConfig.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 '../ReactFlightServerConfigStream'; 11 | export * from 'react-transport-dom-webpack/src/ReactFlightServerWebpackBundlerConfig'; 12 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerFormatConfig.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 '../ReactDOMServerFormatConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerFormatConfig.dom-relay.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 '../ReactDOMServerFormatConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerFormatConfig.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 '../ReactDOMServerFormatConfig'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerStreamConfig.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 '../ReactServerStreamConfigBrowser'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerStreamConfig.dom-relay.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 '../ReactServerStreamConfigNode'; 11 | -------------------------------------------------------------------------------- /packages/react-server/src/forks/ReactServerStreamConfig.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 '../ReactServerStreamConfigNode'; 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 | export * from './src/ReactTestRenderer'; 11 | -------------------------------------------------------------------------------- /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 | module.exports = require('react-shallow-renderer'); 4 | -------------------------------------------------------------------------------- /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 | export {default} from 'react-shallow-renderer'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/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 | export * from './src/ReactFlightDOMRelayClient'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-transport-dom-relay", 3 | "version": "0.1.0", 4 | "private": true, 5 | "repository": { 6 | "type" : "git", 7 | "url" : "https://github.com/facebook/react.git", 8 | "directory": "packages/react-transport-dom-relay" 9 | }, 10 | "dependencies": { 11 | "object-assign": "^4.1.1", 12 | "scheduler": "^0.11.0" 13 | }, 14 | "peerDependencies": { 15 | "react": "^17.0.0", 16 | "react-dom": "^17.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/server-runtime.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-server/src/ReactFlightServerRuntime'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/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 | export * from './src/ReactFlightDOMRelayServer'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/src/ReactFlightDOMRelayClient.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 { 11 | createResponse, 12 | resolveModel, 13 | resolveError, 14 | close, 15 | } from 'react-client/src/ReactFlightClient'; 16 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/src/ReactFlightDOMRelayServer.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 {ReactModel} from 'react-server/src/ReactFlightServer'; 11 | import type { 12 | BundlerConfig, 13 | Destination, 14 | } from './ReactFlightDOMRelayServerHostConfig'; 15 | 16 | import {createRequest, startWork} from 'react-server/src/ReactFlightServer'; 17 | 18 | function render( 19 | model: ReactModel, 20 | destination: Destination, 21 | config: BundlerConfig, 22 | ): void { 23 | const request = createRequest(model, destination, config); 24 | startWork(request); 25 | } 26 | 27 | export {render}; 28 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/src/__mocks__/ReactFlightDOMRelayClientIntegration.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 ReactFlightDOMRelayClientIntegration = { 11 | resolveModuleReference(moduleData) { 12 | return moduleData; 13 | }, 14 | preloadModule(moduleReference) {}, 15 | requireModule(moduleReference) { 16 | return moduleReference; 17 | }, 18 | }; 19 | 20 | module.exports = ReactFlightDOMRelayClientIntegration; 21 | -------------------------------------------------------------------------------- /packages/react-transport-dom-relay/src/__mocks__/ReactFlightDOMRelayServerIntegration.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 ReactFlightDOMRelayServerIntegration = { 11 | emitModel(destination, id, json) { 12 | destination.push({ 13 | type: 'json', 14 | id: id, 15 | json: json, 16 | }); 17 | }, 18 | emitError(destination, id, message, stack) { 19 | destination.push({ 20 | type: 'error', 21 | id: id, 22 | json: {message, stack}, 23 | }); 24 | }, 25 | close(destination) {}, 26 | resolveModuleMetaData(config, resource) { 27 | return resource; 28 | }, 29 | }; 30 | 31 | module.exports = ReactFlightDOMRelayServerIntegration; 32 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/README.md: -------------------------------------------------------------------------------- 1 | # react-transport-dom-webpack 2 | 3 | Experimental React Flight bindings for DOM using Webpack. 4 | 5 | **Use it at your own risk.** 6 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/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 | export * from './src/ReactFlightDOMClient'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-transport-dom-webpack.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-transport-dom-webpack.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./cjs/react-transport-dom-webpack-plugin.js'); 4 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/server-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-transport-dom-webpack-server-runtime.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-transport-dom-webpack-server-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/server.browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-transport-dom-webpack-server.browser.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-transport-dom-webpack-server.browser.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/server.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./server.node'); 4 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/npm/server.node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-transport-dom-webpack-server.node.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-transport-dom-webpack-server.node.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/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 | * @flow 8 | */ 9 | 10 | export {default} from './src/ReactFlightWebpackPlugin'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/server-runtime.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-server/src/ReactFlightServerRuntime'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/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 | export * from './src/ReactFlightDOMServerBrowser'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/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 | export * from './server.node'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/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 | export * from './src/ReactFlightDOMServerNode'; 11 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/src/ReactFlightServerWebpackBundlerConfig.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 | type WebpackMap = { 11 | [filename: string]: ModuleMetaData, 12 | }; 13 | 14 | export type BundlerConfig = WebpackMap; 15 | 16 | // eslint-disable-next-line no-unused-vars 17 | export type ModuleReference = string; 18 | 19 | export type ModuleMetaData = { 20 | id: string, 21 | chunks: Array, 22 | name: string, 23 | }; 24 | 25 | export function resolveModuleMetaData( 26 | config: BundlerConfig, 27 | modulePath: ModuleReference, 28 | ): ModuleMetaData { 29 | return config[modulePath]; 30 | } 31 | -------------------------------------------------------------------------------- /packages/react-transport-dom-webpack/src/ReactFlightWebpackPlugin.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 class ReactFlightWebpackPlugin { 11 | constructor(options: {isServer: boolean}) {} 12 | apply(compiler: any) {} 13 | } 14 | -------------------------------------------------------------------------------- /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.stable.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 { 11 | Children, 12 | createRef, 13 | Component, 14 | PureComponent, 15 | createContext, 16 | forwardRef, 17 | lazy, 18 | memo, 19 | useCallback, 20 | useContext, 21 | useEffect, 22 | useImperativeHandle, 23 | useDebugValue, 24 | useLayoutEffect, 25 | useMemo, 26 | useReducer, 27 | useRef, 28 | useState, 29 | Fragment, 30 | Profiler, 31 | StrictMode, 32 | Suspense, 33 | createElement, 34 | cloneElement, 35 | isValidElement, 36 | version, 37 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 38 | createFactory, 39 | } from './src/React'; 40 | -------------------------------------------------------------------------------- /packages/react/jsx-dev-runtime.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 {Fragment, jsxDEV} from './src/jsx/ReactJSX'; 11 | -------------------------------------------------------------------------------- /packages/react/jsx-runtime.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 | export {Fragment, jsx, jsxs} from './src/jsx/ReactJSX'; 10 | -------------------------------------------------------------------------------- /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/npm/jsx-dev-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-jsx-dev-runtime.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/npm/jsx-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-jsx-runtime.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-jsx-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/npm/unstable-cache.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-unstable-cache.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/react-unstable-cache.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/src/BadMapPolyfill.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 | export let hasBadMapPolyfill; 10 | 11 | if (__DEV__) { 12 | hasBadMapPolyfill = false; 13 | try { 14 | const frozenObject = Object.freeze({}); 15 | /* eslint-disable no-new */ 16 | new Map([[frozenObject, null]]); 17 | new Set([frozenObject]); 18 | /* eslint-enable no-new */ 19 | } catch (e) { 20 | // TODO: Consider warning about bad polyfills 21 | hasBadMapPolyfill = true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/react/src/IsSomeRendererActing.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 | * Used by act() to track whether you're inside an act() scope. 12 | */ 13 | 14 | const IsSomeRendererActing = { 15 | current: (false: boolean), 16 | }; 17 | export default IsSomeRendererActing; 18 | -------------------------------------------------------------------------------- /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 | export function createRef(): RefObject { 13 | const refObject = { 14 | current: null, 15 | }; 16 | if (__DEV__) { 17 | Object.seal(refObject); 18 | } 19 | return refObject; 20 | } 21 | -------------------------------------------------------------------------------- /packages/react/src/ReactCurrentBatchConfig.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 | * Keeps track of the current batch's configuration such as how long an update 12 | * should suspend for if it needs to. 13 | */ 14 | const ReactCurrentBatchConfig = { 15 | transition: (0: number), 16 | }; 17 | 18 | export default ReactCurrentBatchConfig; 19 | -------------------------------------------------------------------------------- /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/ReactInternalTypes'; 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/ReactInternalTypes'; 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/ReactStartTransition.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 ReactCurrentBatchConfig from './ReactCurrentBatchConfig'; 11 | 12 | export function startTransition(scope: () => void) { 13 | const prevTransition = ReactCurrentBatchConfig.transition; 14 | ReactCurrentBatchConfig.transition = 1; 15 | try { 16 | scope(); 17 | } finally { 18 | ReactCurrentBatchConfig.transition = prevTransition; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/react/src/__tests__/ReactCache-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 | */ 9 | 10 | 'use strict'; 11 | 12 | describe('ReactCache', () => { 13 | let ReactCache; 14 | 15 | beforeEach(() => { 16 | if (__EXPERIMENTAL__) { 17 | ReactCache = require('react/unstable-cache'); 18 | } 19 | }); 20 | 21 | // TODO: test something useful. 22 | // @gate experimental 23 | it('exports something', () => { 24 | expect(ReactCache.readCache).not.toBe(undefined); 25 | }); 26 | }); 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/React.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' { 16 | export class Component { 17 | props: any; 18 | state: any; 19 | context: any; 20 | static name: string; 21 | constructor(props?, context?); 22 | setState(partial : any, callback ?: any) : void; 23 | forceUpdate(callback ?: any) : void; 24 | } 25 | export let PropTypes : any; 26 | export function createElement(tag : any, props ?: any, ...children : any[]) : any 27 | } 28 | -------------------------------------------------------------------------------- /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/react/src/jsx/ReactJSX.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 | import {REACT_FRAGMENT_TYPE} from 'shared/ReactSymbols'; 10 | import { 11 | jsxWithValidationStatic, 12 | jsxWithValidationDynamic, 13 | jsxWithValidation, 14 | } from './ReactJSXElementValidator'; 15 | import {jsx as jsxProd} from './ReactJSXElement'; 16 | const jsx = __DEV__ ? jsxWithValidationDynamic : jsxProd; 17 | // we may want to special case jsxs internally to take advantage of static children. 18 | // for now we can ship identical prod functions 19 | const jsxs = __DEV__ ? jsxWithValidationStatic : jsxProd; 20 | const jsxDEV = __DEV__ ? jsxWithValidation : undefined; 21 | 22 | export {REACT_FRAGMENT_TYPE as Fragment, jsx, jsxs, jsxDEV}; 23 | -------------------------------------------------------------------------------- /packages/react/unstable-cache.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 | export {createCache, readCache, CacheProvider} from './src/cache/ReactCache'; 10 | -------------------------------------------------------------------------------- /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/npm/unstable_post_task.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler-unstable_post_task.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler-unstable_post_task.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 | export const enableIsInputPending = false; 11 | export const enableProfiling = __PROFILE__; 12 | -------------------------------------------------------------------------------- /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 | export * from './forks/SchedulerHostConfig.default' -------------------------------------------------------------------------------- /packages/scheduler/src/SchedulerPriorities.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 PriorityLevel = 0 | 1 | 2 | 3 | 4 | 5; 11 | 12 | // TODO: Use symbols? 13 | export const NoPriority = 0; 14 | export const ImmediatePriority = 1; 15 | export const UserBlockingPriority = 2; 16 | export const NormalPriority = 3; 17 | export const LowPriority = 4; 18 | export const IdlePriority = 5; 19 | -------------------------------------------------------------------------------- /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 { 10 | enableIsInputPending, 11 | enableSchedulerDebugging, 12 | enableProfiling: enableProfilingFeatureFlag, 13 | } = require('SchedulerFeatureFlags'); 14 | 15 | export const enableProfiling = __PROFILE__ && enableProfilingFeatureFlag; 16 | -------------------------------------------------------------------------------- /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_flushAllWithoutAsserting, 14 | unstable_flushNumberOfYields, 15 | unstable_flushExpired, 16 | unstable_clearYields, 17 | unstable_flushUntilNextPaint, 18 | unstable_flushAll, 19 | unstable_yieldValue, 20 | unstable_advanceTime, 21 | } from './src/forks/SchedulerHostConfig.mock' -------------------------------------------------------------------------------- /packages/scheduler/unstable_post_task.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/SchedulerPostTask'; 11 | -------------------------------------------------------------------------------- /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 | typeof window.document !== 'undefined' && 13 | typeof window.document.createElement !== 'undefined' 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 | // ReactFiber 22 | _owner: any, 23 | 24 | // __DEV__ 25 | _store: {validated: boolean, ...}, 26 | _self: React$Element, 27 | _shadowChildren: any, 28 | _source: Source, 29 | |}; 30 | -------------------------------------------------------------------------------- /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 | * @flow 8 | */ 9 | 10 | // import * as React from 'react'; 11 | 12 | // const ReactSharedInternals = 13 | // React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 14 | import ReactSharedInternals from 'react/src/ReactSharedInternals'; 15 | 16 | export default ReactSharedInternals; 17 | -------------------------------------------------------------------------------- /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 | // TODO: this is special because it gets imported during build. 9 | export default '17.0.0'; 10 | -------------------------------------------------------------------------------- /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/object-assign.inline-umd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2004-present Facebook. All Rights Reserved. 3 | */ 4 | 5 | const hasOwnProperty = Object.prototype.hasOwnProperty; 6 | 7 | const _assign = function(to, from) { 8 | for (const key in from) { 9 | if (hasOwnProperty.call(from, key)) { 10 | to[key] = from[key]; 11 | } 12 | } 13 | }; 14 | 15 | export default Object.assign || 16 | function(target, sources) { 17 | if (target == null) { 18 | throw new TypeError('Object.assign target cannot be null or undefined'); 19 | } 20 | 21 | const to = Object(target); 22 | 23 | for (let nextIndex = 1; nextIndex < arguments.length; nextIndex++) { 24 | const nextSource = arguments[nextIndex]; 25 | if (nextSource != null) { 26 | _assign(to, Object(nextSource)); 27 | } 28 | } 29 | 30 | return to; 31 | }; 32 | -------------------------------------------------------------------------------- /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 * as 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/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 | const objectIs: (x: any, y: any) => boolean = 21 | typeof Object.is === 'function' ? Object.is : is; 22 | 23 | export default objectIs; 24 | -------------------------------------------------------------------------------- /packages/shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "shared", 4 | "version": "0.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /packages/use-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/useSubscription'; 13 | -------------------------------------------------------------------------------- /packages/use-subscription/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/use-subscription.production.min.js'); 5 | } else { 6 | module.exports = require('./cjs/use-subscription.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/use-subscription/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "use-subscription", 3 | "description": "Reusable hooks", 4 | "version": "1.5.0", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/facebook/react.git", 8 | "directory": "packages/use-subscription" 9 | }, 10 | "files": [ 11 | "LICENSE", 12 | "README.md", 13 | "build-info.json", 14 | "index.js", 15 | "cjs/" 16 | ], 17 | "license": "MIT", 18 | "dependencies": { 19 | "object-assign": "^4.1.1" 20 | }, 21 | "peerDependencies": { 22 | "react": "^17.0.0" 23 | }, 24 | "devDependencies": { 25 | "rxjs": "^5.5.6" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /react/img/QQ20220314-230014@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/QQ20220314-230014@2x.png -------------------------------------------------------------------------------- /react/img/QQ20220316-111728.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/QQ20220316-111728.png -------------------------------------------------------------------------------- /react/img/QQ20220317-153247.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/QQ20220317-153247.png -------------------------------------------------------------------------------- /react/img/QQ20220318-171230.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/QQ20220318-171230.png -------------------------------------------------------------------------------- /react/img/WX20220310-121500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/WX20220310-121500.png -------------------------------------------------------------------------------- /react/img/image-20220302140906771.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/image-20220302140906771.png -------------------------------------------------------------------------------- /react/img/image-20220310121153997.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/image-20220310121153997.png -------------------------------------------------------------------------------- /react/img/image-20220418212951811.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangYueYang/react-code-test/225a4171cddb9ab2ef04a883a7f425982892c2f2/react/img/image-20220418212951811.png -------------------------------------------------------------------------------- /src/demo/demo01.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | const Demo01 = () => { 4 | 5 | const [num, setNum] = React.useState(22) 6 | const [text, setText] = React.useState('hello hook') 7 | const changeNum = () => { 8 | setNum(24) 9 | } 10 | 11 | return ( 12 |
13 |

react function component

14 | Hook num: {num} 15 | Hook text: {text} 16 |
17 | ) 18 | } 19 | 20 | export default Demo01 -------------------------------------------------------------------------------- /src/demo/useEffect.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const UseEffect = () => { 4 | 5 | const [num, setNum] = React.useState(0) 6 | const [name, setName] = React.useState('name') 7 | React.useEffect(() => { 8 | console.log('useEffect 执行啦') 9 | }) 10 | 11 | React.useEffect(() => { 12 | console.log('依赖项是: []') 13 | }, []) 14 | 15 | React.useEffect(() => { 16 | console.log('依赖的是 num') 17 | }, [num]) 18 | 19 | 20 | React.useEffect(() => { 21 | console.log('依赖的是 name') 22 | }, [name]) 23 | return ( 24 |
25 | React useEffect 26 |
setNum(num + 1)}>{num}
27 |
setName(name + 1)}>{name}
28 |
29 | ) 30 | } 31 | 32 | export default UseEffect 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |
11 | 12 | --------------------------------------------------------------------------------