GeezerVison is showing github.com — Add Modern WWW build (#18028) · react/react@8777b44
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/client/ReactDOM.js +8-6Lines changed: 8 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -56,6 +56,7 @@ import ReactVersion from 'shared/ReactVersion'; | 56 | 56 | import invariant from 'shared/invariant'; | 57 | 57 | import { | 58 | 58 | exposeConcurrentModeAPIs, | | 59 | + disableLegacyReactDOMAPIs, | 59 | 60 | disableUnstableCreatePortal, | 60 | 61 | disableUnstableRenderSubtreeIntoContainer, | 61 | 62 | warnUnstableRenderSubtreeIntoContainer, | @@ -133,12 +134,6 @@ function createPortal( | 133 | 134 | const ReactDOM: Object = { | 134 | 135 | createPortal, | 135 | 136 |
| 136 | | - // Legacy | 137 | | - findDOMNode, | 138 | | - hydrate, | 139 | | - render, | 140 | | - unmountComponentAtNode, | 141 | | - | 142 | 137 | unstable_batchedUpdates: batchedUpdates, | 143 | 138 |
| 144 | 139 | flushSync: flushSync, | @@ -166,6 +161,13 @@ const ReactDOM: Object = { | 166 | 161 | version: ReactVersion, | 167 | 162 | }; | 168 | 163 |
| | 164 | +if (!disableLegacyReactDOMAPIs) { | | 165 | + ReactDOM.findDOMNode = findDOMNode; | | 166 | + ReactDOM.hydrate = hydrate; | | 167 | + ReactDOM.render = render; | | 168 | + ReactDOM.unmountComponentAtNode = unmountComponentAtNode; | | 169 | +} | | 170 | + | 169 | 171 | if (exposeConcurrentModeAPIs) { | 170 | 172 | ReactDOM.createRoot = createRoot; | 171 | 173 | ReactDOM.createBlockingRoot = createBlockingRoot; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/client/ReactDOMFB.js +18-13Lines changed: 18 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,19 +13,24 @@ import ReactDOM from './ReactDOM'; | 13 | 13 | import {isEnabled} from '../events/ReactBrowserEventEmitter'; | 14 | 14 | import {getClosestInstanceFromNode} from './ReactDOMComponentTree'; | 15 | 15 |
| 16 | | -Object.assign( | 17 | | - (ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: any), | 18 | | - { | 19 | | - // These are real internal dependencies that are trickier to remove: | 20 | | - ReactBrowserEventEmitter: { | 21 | | - isEnabled, | | 16 | +if (__EXPERIMENTAL__) { | | 17 | + // This is a modern WWW build. | | 18 | + // It should be the same as open source. Don't add new things here. | | 19 | +} else { | | 20 | + // For classic WWW builds, include a few internals that are already in use. | | 21 | + Object.assign( | | 22 | + (ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: any), | | 23 | + { | | 24 | + ReactBrowserEventEmitter: { | | 25 | + isEnabled, | | 26 | + }, | | 27 | + ReactDOMComponentTree: { | | 28 | + getClosestInstanceFromNode, | | 29 | + }, | | 30 | + // Perf experiment | | 31 | + addUserTimingListener, | 22 | 32 | }, | 23 | | - ReactDOMComponentTree: { | 24 | | - getClosestInstanceFromNode, | 25 | | - }, | 26 | | - // Perf experiment | 27 | | - addUserTimingListener, | 28 | | - }, | 29 | | -); | | 33 | + ); | | 34 | +} | 30 | 35 |
| 31 | 36 | export default ReactDOM; |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.js +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -425,7 +425,9 @@ export function createWorkInProgress( | 425 | 425 |
| 426 | 426 | if (__DEV__) { | 427 | 427 | // DEV-only fields | 428 | | - workInProgress._debugID = current._debugID; | | 428 | + if (enableUserTimingAPI) { | | 429 | + workInProgress._debugID = current._debugID; | | 430 | + } | 429 | 431 | workInProgress._debugSource = current._debugSource; | 430 | 432 | workInProgress._debugOwner = current._debugOwner; | 431 | 433 | workInProgress._debugHookTypes = current._debugHookTypes; | @@ -958,7 +960,9 @@ export function assignFiberPropertiesInDEV( | 958 | 960 | target.selfBaseDuration = source.selfBaseDuration; | 959 | 961 | target.treeBaseDuration = source.treeBaseDuration; | 960 | 962 | } | 961 | | - target._debugID = source._debugID; | | 963 | + if (enableUserTimingAPI) { | | 964 | + target._debugID = source._debugID; | | 965 | + } | 962 | 966 | target._debugSource = source._debugSource; | 963 | 967 | target._debugOwner = source._debugOwner; | 964 | 968 | target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/ReactFeatureFlags.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,6 +114,9 @@ export const disableLegacyContext = false; | 114 | 114 | // Disables React.createFactory | 115 | 115 | export const disableCreateFactory = false; | 116 | 116 |
| | 117 | +// Disables hydrate, render, findDOMNode, unmountComponentAtNode | | 118 | +export const disableLegacyReactDOMAPIs = false; | | 119 | + | 117 | 120 | // Disables children for <textarea> elements | 118 | 121 | export const disableTextareaChildren = false; | 119 | 122 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-fb.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native-fb'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.native-fb'; | 14 | 14 |
| 15 | 15 | // Uncomment to re-export dynamic flags from the fbsource version. | 16 | 16 | export const { | @@ -46,6 +46,7 @@ export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; | 46 | 46 | export const enableTrainModelFix = true; | 47 | 47 | export const enableTrustedTypesIntegration = false; | 48 | 48 | export const disableCreateFactory = false; | | 49 | +export const disableLegacyReactDOMAPIs = false; | 49 | 50 | export const disableTextareaChildren = false; | 50 | 51 | export const disableMapsAsChildren = false; | 51 | 52 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -63,4 +64,4 @@ export function addUserTimingListener() { | 63 | 64 | // eslint-disable-next-line no-unused-vars | 64 | 65 | type Check<_X, Y: _X, X: Y = _X> = null; | 65 | 66 | // eslint-disable-next-line no-unused-expressions | 66 | | -(null: Check<FeatureFlagsShimType, FeatureFlagsType>); | | 67 | +(null: Check<ExportsType, FeatureFlagsType>); |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-oss.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native-oss'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.native-oss'; | 14 | 14 |
| 15 | 15 | export const debugRenderPhaseSideEffectsForStrictMode = false; | 16 | 16 | export const enableUserTimingAPI = __DEV__; | @@ -41,6 +41,7 @@ export const enableTrainModelFix = true; | 41 | 41 | export const enableTrustedTypesIntegration = false; | 42 | 42 | export const enableNativeTargetAsInstance = false; | 43 | 43 | export const disableCreateFactory = false; | | 44 | +export const disableLegacyReactDOMAPIs = false; | 44 | 45 | export const disableTextareaChildren = false; | 45 | 46 | export const disableMapsAsChildren = false; | 46 | 47 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -58,4 +59,4 @@ export function addUserTimingListener() { | 58 | 59 | // eslint-disable-next-line no-unused-vars | 59 | 60 | type Check<_X, Y: _X, X: Y = _X> = null; | 60 | 61 | // eslint-disable-next-line no-unused-expressions | 61 | | -(null: Check<FeatureFlagsShimType, FeatureFlagsType>); | | 62 | +(null: Check<ExportsType, FeatureFlagsType>); |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.persistent.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.persistent'; | 14 | 14 |
| 15 | 15 | export const debugRenderPhaseSideEffectsForStrictMode = false; | 16 | 16 | export const enableUserTimingAPI = __DEV__; | @@ -41,6 +41,7 @@ export const enableTrainModelFix = true; | 41 | 41 | export const enableTrustedTypesIntegration = false; | 42 | 42 | export const enableNativeTargetAsInstance = false; | 43 | 43 | export const disableCreateFactory = false; | | 44 | +export const disableLegacyReactDOMAPIs = false; | 44 | 45 | export const disableTextareaChildren = false; | 45 | 46 | export const disableMapsAsChildren = false; | 46 | 47 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -58,4 +59,4 @@ export function addUserTimingListener() { | 58 | 59 | // eslint-disable-next-line no-unused-vars | 59 | 60 | type Check<_X, Y: _X, X: Y = _X> = null; | 60 | 61 | // eslint-disable-next-line no-unused-expressions | 61 | | -(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>); | | 62 | +(null: Check<ExportsType, FeatureFlagsType>); |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.test-renderer'; | 14 | 14 |
| 15 | 15 | export const debugRenderPhaseSideEffectsForStrictMode = false; | 16 | 16 | export const enableUserTimingAPI = __DEV__; | @@ -41,6 +41,7 @@ export const enableTrainModelFix = true; | 41 | 41 | export const enableTrustedTypesIntegration = false; | 42 | 42 | export const enableNativeTargetAsInstance = false; | 43 | 43 | export const disableCreateFactory = false; | | 44 | +export const disableLegacyReactDOMAPIs = false; | 44 | 45 | export const disableTextareaChildren = false; | 45 | 46 | export const disableMapsAsChildren = false; | 46 | 47 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -58,4 +59,4 @@ export function addUserTimingListener() { | 58 | 59 | // eslint-disable-next-line no-unused-vars | 59 | 60 | type Check<_X, Y: _X, X: Y = _X> = null; | 60 | 61 | // eslint-disable-next-line no-unused-expressions | 61 | | -(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>); | | 62 | +(null: Check<ExportsType, FeatureFlagsType>); |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.test-renderer.www'; | 14 | 14 |
| 15 | 15 | export const debugRenderPhaseSideEffectsForStrictMode = false; | 16 | 16 | export const enableUserTimingAPI = __DEV__; | @@ -22,8 +22,10 @@ export const enableSuspenseServerRenderer = false; | 22 | 22 | export const enableSelectiveHydration = false; | 23 | 23 | export const enableChunksAPI = false; | 24 | 24 | export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; | | 25 | +export const warnAboutShorthandPropertyCollision = true; | 25 | 26 | export const enableSchedulerDebugging = false; | 26 | 27 | export const disableJavaScriptURLs = false; | | 28 | +export const disableInputAttributeSyncing = false; | 27 | 29 | export const enableDeprecatedFlareAPI = true; | 28 | 30 | export const enableFundamentalAPI = false; | 29 | 31 | export const enableScopeAPI = true; | @@ -39,6 +41,7 @@ export const enableTrainModelFix = true; | 39 | 41 | export const enableTrustedTypesIntegration = false; | 40 | 42 | export const enableNativeTargetAsInstance = false; | 41 | 43 | export const disableCreateFactory = false; | | 44 | +export const disableLegacyReactDOMAPIs = false; | 42 | 45 | export const disableTextareaChildren = false; | 43 | 46 | export const disableMapsAsChildren = false; | 44 | 47 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -56,4 +59,4 @@ export function addUserTimingListener() { | 56 | 59 | // eslint-disable-next-line no-unused-vars | 57 | 60 | type Check<_X, Y: _X, X: Y = _X> = null; | 58 | 61 | // eslint-disable-next-line no-unused-expressions | 59 | | -(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>); | | 62 | +(null: Check<ExportsType, FeatureFlagsType>); |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.testing.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import invariant from 'shared/invariant'; | 11 | 11 |
| 12 | 12 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 13 | | -import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent'; | | 13 | +import typeof * as ExportsType from './ReactFeatureFlags.testing'; | 14 | 14 |
| 15 | 15 | export const debugRenderPhaseSideEffectsForStrictMode = false; | 16 | 16 | export const enableUserTimingAPI = __DEV__; | @@ -41,6 +41,7 @@ export const enableTrainModelFix = true; | 41 | 41 | export const enableTrustedTypesIntegration = false; | 42 | 42 | export const enableNativeTargetAsInstance = false; | 43 | 43 | export const disableCreateFactory = false; | | 44 | +export const disableLegacyReactDOMAPIs = false; | 44 | 45 | export const disableTextareaChildren = false; | 45 | 46 | export const disableMapsAsChildren = false; | 46 | 47 | export const disableUnstableRenderSubtreeIntoContainer = false; | @@ -58,4 +59,4 @@ export function addUserTimingListener() { | 58 | 59 | // eslint-disable-next-line no-unused-vars | 59 | 60 | type Check<_X, Y: _X, X: Y = _X> = null; | 60 | 61 | // eslint-disable-next-line no-unused-expressions | 61 | | -(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>); | | 62 | +(null: Check<ExportsType, FeatureFlagsType>); |
|