Skip to content

Commit

Permalink
Update fbt and recoil to use the ReactDOMLegacy_DEPRECATED entry poin…
Browse files Browse the repository at this point in the history
…t (#1086)

Summary:
Pull Request resolved: facebookexperimental/Recoil#1086

We're updating the internal entry point for the old React API to be ReactDOMLegacy_DEPRECATED. For the requires to keep working internally and externally I need to update the module mapping and the source to use these entry points.

See https://fb.workplace.com/groups/react.fyi/permalink/4411697998840538/ for context.

Reviewed By: rickhanlonii

Differential Revision: D29334366

fbshipit-source-id: 2ab2a118b2ea57094992dba29dc3ee49d28b2859
  • Loading branch information
jackwolfskin0302 authored and facebook-github-bot committed Jun 25, 2021
1 parent 1a952df commit a9a3d73
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"root": ["./src"],
"alias": {
"React": "react",
"ReactDOM": "react-dom",
"ReactDOMLegacy_DEPRECATED": "react-dom",
"ReactNative": "react-native",
"ReactTestUtils": "react-dom/test-utils"
}
Expand Down
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ suppress_type=$FlowFixMe
suppress_type=$FlowOSSFixMe

module.name_mapper='React' -> '<PROJECT_ROOT>/node_modules/react'
module.name_mapper='ReactDOM' -> '<PROJECT_ROOT>/node_modules/react-dom'
module.name_mapper='ReactDOMLegacy_DEPRECATED' -> '<PROJECT_ROOT>/node_modules/react-dom'
module.name_mapper='ReactNative' -> '<PROJECT_ROOT>/node_modules/react-native'
module.name_mapper='ReactTestUtils' -> '<PROJECT_ROOT>/node_modules/react-dom/test-utils'

Expand Down
2 changes: 1 addition & 1 deletion flow-typed/npm/ReactDOM_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
* https://github.com/flowtype/flow-typed
*/

declare module 'ReactDOM' {
declare module 'ReactDOMLegacy_DEPRECATED' {
declare module.exports: any;
}
2 changes: 1 addition & 1 deletion packages/recoil-devtools/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"root": ["./src"],
"alias": {
"React": "react",
"ReactDOM": "react-dom",
"ReactDOMLegacy_DEPRECATED": "react-dom",
"ReactTestUtils": "react-dom/test-utils"
}
}
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import {terser} from 'rollup-plugin-terser';

Expand All @@ -27,7 +27,7 @@ const commonPlugins = [
if (source === 'React') {
return {id: 'react', external: true};
}
if (source === 'ReactDOM') {
if (source === 'ReactDOMLegacy_DEPRECATED') {
return {id: 'react-dom', external: true};
}
if (source === 'ReactNative') {
Expand Down
2 changes: 1 addition & 1 deletion src/core/__tests__/Recoil_RecoilRoot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let React,
const testRecoil = getRecoilTestFn(() => {
React = require('react');
({useState} = require('react'));
ReactDOM = require('ReactDOM');
ReactDOM = require('ReactDOMLegacy_DEPRECATED');
({act} = require('ReactTestUtils'));

({useSetRecoilState} = require('../../hooks/Recoil_Hooks'));
Expand Down
2 changes: 1 addition & 1 deletion src/core/__tests__/Recoil_batcher-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {getRecoilTestFn} = require('../../testing/Recoil_TestingUtils');
let unstable_batchedUpdates, batchUpdates, getBatcher, setBatcher;

const testRecoil = getRecoilTestFn(() => {
({unstable_batchedUpdates} = require('ReactDOM'));
({unstable_batchedUpdates} = require('ReactDOMLegacy_DEPRECATED'));
({batchUpdates, getBatcher, setBatcher} = require('../Recoil_Batching'));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let React,
const testRecoil = getRecoilTestFn(() => {
React = require('react');
({useEffect, useRef} = require('react'));
ReactDOM = require('ReactDOM');
ReactDOM = require('ReactDOMLegacy_DEPRECATED');
({act} = require('ReactTestUtils'));

({RecoilRoot} = require('../../core/Recoil_RecoilRoot.react'));
Expand Down
2 changes: 1 addition & 1 deletion src/recoil_values/__tests__/Recoil_atom-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const testRecoil = getRecoilTestFn(() => {

React = require('react');
({useState, Profiler} = require('react'));
ReactDOM = require('ReactDOM');
ReactDOM = require('ReactDOMLegacy_DEPRECATED');
({act} = require('ReactTestUtils'));

({DEFAULT_VALUE, DefaultValue} = require('../../core/Recoil_Node'));
Expand Down
2 changes: 1 addition & 1 deletion src/recoil_values/__tests__/Recoil_atomFamily-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const testRecoil = getRecoilTestFn(() => {

React = require('react');
({Profiler, useState} = require('react'));
ReactDOM = require('ReactDOM');
ReactDOM = require('ReactDOMLegacy_DEPRECATED');
({act} = require('ReactTestUtils'));

({RecoilRoot} = require('../../core/Recoil_RecoilRoot.react'));
Expand Down
2 changes: 1 addition & 1 deletion src/testing/Recoil_TestingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import type {
} from '../core/Recoil_RecoilValue';
import type {Store} from '../core/Recoil_State';

const ReactDOM = require('ReactDOM');
const ReactDOMComet = require('ReactDOMComet');
const ReactDOM = require('ReactDOMLegacy_DEPRECATED');
const {act} = require('ReactTestUtils');

const {graph} = require('../core/Recoil_Graph');
Expand Down
2 changes: 1 addition & 1 deletion src/util/polyfill/ReactBatchedUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* for our web build
*/

const {unstable_batchedUpdates} = require('ReactDOM');
const {unstable_batchedUpdates} = require('ReactDOMLegacy_DEPRECATED');

module.exports = {unstable_batchedUpdates};

0 comments on commit a9a3d73

Please sign in to comment.