From 487d6d977d6f37b48e4ca89db17b2456c3b4e566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Tue, 9 Apr 2024 12:20:22 -0400 Subject: [PATCH] Rename SECRET INTERNALS to `__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE` (#28789) Follow up to #28783 and #28786. Since we've changed the implementations of these we can rename them to something a bit more descriptive while we're at it, since anyone depending on them will need to upgrade their code anyway. "react" with no condition: `__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE` "react" with "react-server" condition: `__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE` "react-dom": `__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE` --- fixtures/dom/public/act-dom.html | 2 +- packages/react-cache/src/ReactCacheOld.js | 2 +- .../src/__tests__/legacy/editing-test.js | 23 +- .../__tests__/legacy/inspectElement-test.js | 122 ++-- .../__tests__/legacy/storeLegacy-v15-test.js | 651 +++++++++++------- .../src/devtools/cache.js | 2 +- packages/react-dom/client.js | 2 +- packages/react-dom/index.classic.fb.js | 2 +- packages/react-dom/index.experimental.js | 2 +- packages/react-dom/index.js | 2 +- packages/react-dom/index.modern.fb.js | 2 +- packages/react-dom/index.stable.js | 2 +- packages/react-dom/npm/client.js | 2 +- packages/react-dom/server-rendering-stub.js | 2 +- packages/react-dom/src/ReactDOMServer.js | 2 +- .../__tests__/ReactCompositeComponent-test.js | 2 +- .../react-dom/src/__tests__/ReactDOM-test.js | 3 +- .../src/__tests__/ReactDOMComponent-test.js | 2 +- .../__tests__/ReactDOMEventListener-test.js | 4 +- .../src/__tests__/ReactDOMLegacyFiber-test.js | 12 +- .../ReactDOMServerIntegrationHooks-test.js | 2 +- ...eactDOMServerIntegrationNewContext-test.js | 3 +- .../ReactDOMSuspensePlaceholder-test.js | 3 +- .../src/__tests__/ReactEmptyComponent-test.js | 3 +- .../ReactLegacyCompositeComponent-test.js | 3 +- .../src/__tests__/ReactLegacyUpdates-test.js | 3 +- .../__tests__/ReactServerRendering-test.js | 2 +- .../src/__tests__/ReactUpdates-test.js | 3 +- .../react-dom-server-rendering-stub-test.js | 3 +- .../src/test-utils/ReactTestUtilsFB.js | 2 +- .../react-dom/unstable_testing.classic.fb.js | 2 +- .../unstable_testing.experimental.js | 2 +- .../react-dom/unstable_testing.modern.fb.js | 2 +- packages/react-dom/unstable_testing.stable.js | 2 +- .../src/__tests__/ReactHooks-test.internal.js | 16 +- .../src/__tests__/ReactMemo-test.js | 4 +- .../src/__tests__/ReactNewContext-test.js | 2 +- .../src/ReactSharedInternalsServer.js | 2 +- packages/react/index.classic.fb.js | 2 +- packages/react/index.experimental.js | 2 +- packages/react/index.js | 2 +- packages/react/index.modern.fb.js | 2 +- packages/react/index.stable.js | 2 +- packages/react/src/ReactClient.js | 2 +- .../react/src/ReactServer.experimental.js | 2 +- packages/react/src/ReactServer.js | 2 +- .../npm/umd/scheduler.development.js | 44 +- .../npm/umd/scheduler.production.min.js | 40 +- .../npm/umd/scheduler.profiling.min.js | 40 +- packages/shared/ReactDOMSharedInternals.js | 2 +- packages/shared/ReactSharedInternals.js | 2 +- packages/shared/forks/Scheduler.umd.js | 3 +- .../shared/forks/consoleWithStackDev.www.js | 2 +- .../ReactBrowserEventEmitter_DO_NOT_USE.js | 4 +- 54 files changed, 607 insertions(+), 448 deletions(-) diff --git a/fixtures/dom/public/act-dom.html b/fixtures/dom/public/act-dom.html index 2aa33da465e26..504a480bfdbcd 100644 --- a/fixtures/dom/public/act-dom.html +++ b/fixtures/dom/public/act-dom.html @@ -10,7 +10,7 @@ diff --git a/packages/react-cache/src/ReactCacheOld.js b/packages/react-cache/src/ReactCacheOld.js index 78d8403afd0f6..7ea17286679d4 100644 --- a/packages/react-cache/src/ReactCacheOld.js +++ b/packages/react-cache/src/ReactCacheOld.js @@ -45,7 +45,7 @@ const Resolved = 1; const Rejected = 2; const SharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function readContext(Context: ReactContext) { const dispatcher = SharedInternals.H; diff --git a/packages/react-devtools-shared/src/__tests__/legacy/editing-test.js b/packages/react-devtools-shared/src/__tests__/legacy/editing-test.js index ec02e33f76433..c6da4b5eccdb3 100644 --- a/packages/react-devtools-shared/src/__tests__/legacy/editing-test.js +++ b/packages/react-devtools-shared/src/__tests__/legacy/editing-test.js @@ -64,11 +64,11 @@ describe('editing interface', () => { act(() => ReactDOM.render( - , + React.createElement(ClassComponent, { + array: [1, 2, 3], + object: {nested: 'initial'}, + shallow: 'initial', + }), document.createElement('div'), ), ); @@ -270,7 +270,10 @@ describe('editing interface', () => { act(() => ReactDOM.render( - , + React.createElement(ClassComponent, { + object: {nested: 'initial'}, + shallow: 'initial', + }), document.createElement('div'), ), ); @@ -489,9 +492,11 @@ describe('editing interface', () => { act(() => ReactDOM.render( - - - , + React.createElement( + LegacyContextProvider, + null, + React.createElement(ClassComponent), + ), document.createElement('div'), ), ); diff --git a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js index 1940e82a80f40..10a355d0430f3 100644 --- a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js @@ -62,7 +62,10 @@ describe('InspectedElementContext', () => { const Example = () => null; act(() => - ReactDOM.render(, document.createElement('div')), + ReactDOM.render( + React.createElement(Example, {a: 1, b: 'abc'}), + document.createElement('div'), + ), ); const id = ((store.getElementIDAtIndex(0): any): number); @@ -91,19 +94,19 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, { + boolean_false: false, + boolean_true: true, + infinity: Infinity, + integer_zero: 0, + integer_one: 1, + float: 1.23, + string: 'abc', + string_empty: '', + nan: NaN, + value_null: null, + value_undefined: undefined, + }), document.createElement('div'), ), ); @@ -178,28 +181,28 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - } - regexp={/abc/giu} - set={setShallow} - set_of_sets={setOfSets} - symbol={Symbol('symbol')} - typed_array={typedArray} - />, + big_int: BigInt(123), + bound_fn: exampleFunction.bind(this), + data_view: dataView, + date: new Date(123), + fn: exampleFunction, + html_element: div, + immutable: immutableMap, + map: mapShallow, + map_of_maps: mapOfMaps, + object_of_objects: objectOfObjects, + react_element: React.createElement('span'), + regexp: /abc/giu, + set: setShallow, + set_of_sets: setOfSets, + symbol: Symbol('symbol'), + typed_array: typedArray, + }), document.createElement('div'), ), ); @@ -333,7 +336,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {object}), document.createElement('div'), ), ); @@ -363,7 +366,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {object}), document.createElement('div'), ), ); @@ -390,7 +393,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {iteratable}), document.createElement('div'), ), ); @@ -445,7 +448,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {data: new CustomData()}), document.createElement('div'), ), ); @@ -537,7 +540,10 @@ describe('InspectedElementContext', () => { }); act(() => - ReactDOM.render(, document.createElement('div')), + ReactDOM.render( + React.createElement(Example, {data: object}), + document.createElement('div'), + ), ); const id = ((store.getElementIDAtIndex(0): any): number); @@ -605,7 +611,7 @@ describe('InspectedElementContext', () => { const Example = ({data}) => null; act(() => ReactDOM.render( - , + React.createElement(Example, {data: testData}), document.createElement('div'), ), ); @@ -631,8 +637,8 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - { ], }, }, - }} - />, + }, + }), document.createElement('div'), ), ); @@ -746,7 +752,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {nestedObject}), document.createElement('div'), ), ); @@ -802,7 +808,7 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, {nestedObject}), document.createElement('div'), ), ); @@ -872,17 +878,17 @@ describe('InspectedElementContext', () => { act(() => ReactDOM.render( - , + React.createElement(Example, { + arrayBuffer: arrayBuffer, + dataView: dataView, + map: map, + set: set, + mapOfMaps: mapOfMaps, + setOfSets: setOfSets, + typedArray: typedArray, + immutable: immutable, + bigInt: bigInt, + }), document.createElement('div'), ), ); diff --git a/packages/react-devtools-shared/src/__tests__/legacy/storeLegacy-v15-test.js b/packages/react-devtools-shared/src/__tests__/legacy/storeLegacy-v15-test.js index 3c24be0093d63..f912638fb508e 100644 --- a/packages/react-devtools-shared/src/__tests__/legacy/storeLegacy-v15-test.js +++ b/packages/react-devtools-shared/src/__tests__/legacy/storeLegacy-v15-test.js @@ -11,13 +11,10 @@ describe('Store (legacy)', () => { let React; let ReactDOM; let store; - const act = (callback: Function) => { callback(); - jest.runAllTimers(); // Flush Bridge operations }; - beforeEach(() => { store = global.store; @@ -27,56 +24,66 @@ describe('Store (legacy)', () => { jest.mock('react-dom', () => jest.requireActual('react-dom-15/dist/react-dom.js'), ); - React = require('react'); ReactDOM = require('react-dom'); }); - it('should not allow a root node to be collapsed', () => { - const Component = () =>
Hi
; - + const Component = () => React.createElement('div', null, 'Hi'); act(() => - ReactDOM.render(, document.createElement('div')), + ReactDOM.render( + React.createElement(Component, { + count: 4, + }), + document.createElement('div'), + ), ); expect(store).toMatchInlineSnapshot(` [root] ▾
`); - expect(store.roots).toHaveLength(1); - const rootID = store.roots[0]; - expect(() => store.toggleIsCollapsed(rootID, true)).toThrow( 'Root nodes cannot be collapsed', ); }); - describe('collapseNodesByDefault:false', () => { beforeEach(() => { store.collapseNodesByDefault = false; }); - it('should support mount and update operations', () => { - const Grandparent = ({count}) => ( -
- - -
- ); - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Grandparent = ({count}) => + React.createElement( + 'div', + null, + React.createElement(Parent, { + count: count, + }), + React.createElement(Parent, { + count: count, + }), + ); + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); const container = document.createElement('div'); - - act(() => ReactDOM.render(, container)); + act(() => + ReactDOM.render( + React.createElement(Grandparent, { + count: 4, + }), + container, + ), + ); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -102,8 +109,14 @@ describe('Store (legacy)', () => { ▾
`); - - act(() => ReactDOM.render(, container)); + act(() => + ReactDOM.render( + React.createElement(Grandparent, { + count: 2, + }), + container, + ), + ); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -121,27 +134,38 @@ describe('Store (legacy)', () => { ▾
`); - act(() => ReactDOM.unmountComponentAtNode(container)); expect(store).toMatchInlineSnapshot(``); }); - it('should support mount and update operations for multiple roots', () => { - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); const containerA = document.createElement('div'); const containerB = document.createElement('div'); - act(() => { - ReactDOM.render(, containerA); - ReactDOM.render(, containerB); + ReactDOM.render( + React.createElement(Parent, { + key: 'A', + count: 3, + }), + containerA, + ); + ReactDOM.render( + React.createElement(Parent, { + key: 'B', + count: 2, + }), + containerB, + ); }); expect(store).toMatchInlineSnapshot(` [root] @@ -161,10 +185,21 @@ describe('Store (legacy)', () => { ▾
`); - act(() => { - ReactDOM.render(, containerA); - ReactDOM.render(, containerB); + ReactDOM.render( + React.createElement(Parent, { + key: 'A', + count: 4, + }), + containerA, + ); + ReactDOM.render( + React.createElement(Parent, { + key: 'B', + count: 1, + }), + containerB, + ); }); expect(store).toMatchInlineSnapshot(` [root] @@ -184,7 +219,6 @@ describe('Store (legacy)', () => { ▾
`); - act(() => ReactDOM.unmountComponentAtNode(containerB)); expect(store).toMatchInlineSnapshot(` [root] @@ -199,35 +233,46 @@ describe('Store (legacy)', () => { ▾
`); - act(() => ReactDOM.unmountComponentAtNode(containerA)); expect(store).toMatchInlineSnapshot(``); }); - it('should not filter DOM nodes from the store tree', () => { - const Grandparent = ({flip}) => ( -
-
- -
- - -
- ); - const Parent = ({flip}) => ( -
- {flip ? 'foo' : null} - - {flip && [null, 'hello', 42]} - {flip ? 'bar' : 'baz'} -
- ); - const Child = () =>
Hi!
; + const Grandparent = ({flip}) => + React.createElement( + 'div', + null, + React.createElement( + 'div', + null, + React.createElement(Parent, { + flip: flip, + }), + ), + React.createElement(Parent, { + flip: flip, + }), + React.createElement(Nothing, null), + ); + const Parent = ({flip}) => + React.createElement( + 'div', + null, + flip ? 'foo' : null, + React.createElement(Child, null), + flip && [null, 'hello', 42], + flip ? 'bar' : 'baz', + ); + const Child = () => React.createElement('div', null, 'Hi!'); const Nothing = () => null; - const container = document.createElement('div'); act(() => - ReactDOM.render(, container), + ReactDOM.render( + React.createElement(Grandparent, { + count: 4, + flip: false, + }), + container, + ), ); expect(store).toMatchInlineSnapshot(` [root] @@ -244,9 +289,14 @@ describe('Store (legacy)', () => {
`); - act(() => - ReactDOM.render(, container), + ReactDOM.render( + React.createElement(Grandparent, { + count: 4, + flip: true, + }), + container, + ), ); expect(store).toMatchInlineSnapshot(` [root] @@ -263,30 +313,37 @@ describe('Store (legacy)', () => {
`); - act(() => ReactDOM.unmountComponentAtNode(container)); expect(store).toMatchInlineSnapshot(``); }); - it('should support collapsing parts of the tree', () => { - const Grandparent = ({count}) => ( -
- - -
- ); - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Grandparent = ({count}) => + React.createElement( + 'div', + null, + React.createElement(Parent, { + count: count, + }), + React.createElement(Parent, { + count: count, + }), + ); + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); act(() => ReactDOM.render( - , + React.createElement(Grandparent, { + count: 2, + }), document.createElement('div'), ), ); @@ -307,11 +364,9 @@ describe('Store (legacy)', () => { ▾
`); - const grandparentID = store.getElementIDAtIndex(0); const parentOneID = store.getElementIDAtIndex(2); const parentTwoID = store.getElementIDAtIndex(8); - act(() => store.toggleIsCollapsed(parentOneID, true)); expect(store).toMatchInlineSnapshot(` [root] @@ -325,7 +380,6 @@ describe('Store (legacy)', () => { ▾
`); - act(() => store.toggleIsCollapsed(parentTwoID, true)); expect(store).toMatchInlineSnapshot(` [root] @@ -334,7 +388,6 @@ describe('Store (legacy)', () => { ▸ `); - act(() => store.toggleIsCollapsed(parentOneID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -348,13 +401,11 @@ describe('Store (legacy)', () => {
`); - act(() => store.toggleIsCollapsed(grandparentID, true)); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => store.toggleIsCollapsed(grandparentID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -369,18 +420,19 @@ describe('Store (legacy)', () => { ▸ `); }); - it('should support adding and removing children', () => { - const Root = ({children}) =>
{children}
; - const Component = () =>
; - + const Root = ({children}) => React.createElement('div', null, children); + const Component = () => React.createElement('div', null); const container = document.createElement('div'); - act(() => ReactDOM.render( - - - , + React.createElement( + Root, + null, + React.createElement(Component, { + key: 'a', + }), + ), container, ), ); @@ -391,13 +443,18 @@ describe('Store (legacy)', () => { ▾
`); - act(() => ReactDOM.render( - - - - , + React.createElement( + Root, + null, + React.createElement(Component, { + key: 'a', + }), + React.createElement(Component, { + key: 'b', + }), + ), container, ), ); @@ -410,12 +467,15 @@ describe('Store (legacy)', () => { ▾
`); - act(() => ReactDOM.render( - - - , + React.createElement( + Root, + null, + React.createElement(Component, { + key: 'b', + }), + ), container, ), ); @@ -427,21 +487,34 @@ describe('Store (legacy)', () => {
`); }); - it('should support reordering of children', () => { - const Root = ({children}) =>
{children}
; - const Component = () =>
; - - const Foo = () =>
{[]}
; - const Bar = () => ( -
{[, ]}
- ); - const foo = ; - const bar = ; - + const Root = ({children}) => React.createElement('div', null, children); + const Component = () => React.createElement('div', null); + const Foo = () => + React.createElement('div', null, [ + React.createElement(Component, { + key: '0', + }), + ]); + const Bar = () => + React.createElement('div', null, [ + React.createElement(Component, { + key: '0', + }), + React.createElement(Component, { + key: '1', + }), + ]); + const foo = React.createElement(Foo, { + key: 'foo', + }); + const bar = React.createElement(Bar, { + key: 'bar', + }); const container = document.createElement('div'); - - act(() => ReactDOM.render({[foo, bar]}, container)); + act(() => + ReactDOM.render(React.createElement(Root, null, [foo, bar]), container), + ); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -457,8 +530,9 @@ describe('Store (legacy)', () => { ▾
`); - - act(() => ReactDOM.render({[bar, foo]}, container)); + act(() => + ReactDOM.render(React.createElement(Root, null, [bar, foo]), container), + ); expect(store).toMatchInlineSnapshot(` [root] ▾ @@ -474,13 +548,11 @@ describe('Store (legacy)', () => { ▾
`); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), true)); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), false)); expect(store).toMatchInlineSnapshot(` [root] @@ -499,30 +571,35 @@ describe('Store (legacy)', () => { `); }); }); - describe('collapseNodesByDefault:true', () => { beforeEach(() => { store.collapseNodesByDefault = true; }); - it('should support mount and update operations', () => { - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); const container = document.createElement('div'); - act(() => ReactDOM.render( -
- - -
, + React.createElement( + 'div', + null, + React.createElement(Parent, { + count: 1, + }), + React.createElement(Parent, { + count: 3, + }), + ), container, ), ); @@ -530,13 +607,18 @@ describe('Store (legacy)', () => { [root] ▸
`); - act(() => ReactDOM.render( -
- - -
, + React.createElement( + 'div', + null, + React.createElement(Parent, { + count: 2, + }), + React.createElement(Parent, { + count: 1, + }), + ), container, ), ); @@ -544,27 +626,38 @@ describe('Store (legacy)', () => { [root] ▸
`); - act(() => ReactDOM.unmountComponentAtNode(container)); expect(store).toMatchInlineSnapshot(``); }); - it('should support mount and update operations for multiple roots', () => { - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); const containerA = document.createElement('div'); const containerB = document.createElement('div'); - act(() => { - ReactDOM.render(, containerA); - ReactDOM.render(, containerB); + ReactDOM.render( + React.createElement(Parent, { + key: 'A', + count: 3, + }), + containerA, + ); + ReactDOM.render( + React.createElement(Parent, { + key: 'B', + count: 2, + }), + containerB, + ); }); expect(store).toMatchInlineSnapshot(` [root] @@ -572,10 +665,21 @@ describe('Store (legacy)', () => { [root] ▸ `); - act(() => { - ReactDOM.render(, containerA); - ReactDOM.render(, containerB); + ReactDOM.render( + React.createElement(Parent, { + key: 'A', + count: 4, + }), + containerA, + ); + ReactDOM.render( + React.createElement(Parent, { + key: 'B', + count: 1, + }), + containerB, + ); }); expect(store).toMatchInlineSnapshot(` [root] @@ -583,54 +687,62 @@ describe('Store (legacy)', () => { [root] ▸ `); - act(() => ReactDOM.unmountComponentAtNode(containerB)); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => ReactDOM.unmountComponentAtNode(containerA)); expect(store).toMatchInlineSnapshot(``); }); - it('should not filter DOM nodes from the store tree', () => { - const Grandparent = ({flip}) => ( -
-
- -
- - -
- ); - const Parent = ({flip}) => ( -
- {flip ? 'foo' : null} - - {flip && [null, 'hello', 42]} - {flip ? 'bar' : 'baz'} -
- ); - const Child = () =>
Hi!
; + const Grandparent = ({flip}) => + React.createElement( + 'div', + null, + React.createElement( + 'div', + null, + React.createElement(Parent, { + flip: flip, + }), + ), + React.createElement(Parent, { + flip: flip, + }), + React.createElement(Nothing, null), + ); + const Parent = ({flip}) => + React.createElement( + 'div', + null, + flip ? 'foo' : null, + React.createElement(Child, null), + flip && [null, 'hello', 42], + flip ? 'bar' : 'baz', + ); + const Child = () => React.createElement('div', null, 'Hi!'); const Nothing = () => null; - const container = document.createElement('div'); act(() => - ReactDOM.render(, container), + ReactDOM.render( + React.createElement(Grandparent, { + count: 4, + flip: false, + }), + container, + ), ); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), false)); expect(store).toMatchInlineSnapshot(` [root] ▾
`); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(1), false)); expect(store).toMatchInlineSnapshot(` [root] @@ -640,9 +752,14 @@ describe('Store (legacy)', () => { ▸ `); - act(() => - ReactDOM.render(, container), + ReactDOM.render( + React.createElement(Grandparent, { + count: 4, + flip: true, + }), + container, + ), ); expect(store).toMatchInlineSnapshot(` [root] @@ -652,30 +769,37 @@ describe('Store (legacy)', () => { ▸ `); - act(() => ReactDOM.unmountComponentAtNode(container)); expect(store).toMatchInlineSnapshot(``); }); - it('should support expanding parts of the tree', () => { - const Grandparent = ({count}) => ( -
- - -
- ); - const Parent = ({count}) => ( -
- {new Array(count).fill(true).map((_, index) => ( - - ))} -
- ); - const Child = () =>
Hi!
; - + const Grandparent = ({count}) => + React.createElement( + 'div', + null, + React.createElement(Parent, { + count: count, + }), + React.createElement(Parent, { + count: count, + }), + ); + const Parent = ({count}) => + React.createElement( + 'div', + null, + new Array(count).fill(true).map((_, index) => + React.createElement(Child, { + key: index, + }), + ), + ); + const Child = () => React.createElement('div', null, 'Hi!'); act(() => ReactDOM.render( - , + React.createElement(Grandparent, { + count: 2, + }), document.createElement('div'), ), ); @@ -683,16 +807,13 @@ describe('Store (legacy)', () => { [root] ▸ `); - const grandparentID = store.getElementIDAtIndex(0); - act(() => store.toggleIsCollapsed(grandparentID, false)); expect(store).toMatchInlineSnapshot(` [root] ▾
`); - const parentDivID = store.getElementIDAtIndex(1); act(() => store.toggleIsCollapsed(parentDivID, false)); expect(store).toMatchInlineSnapshot(` @@ -702,10 +823,8 @@ describe('Store (legacy)', () => { ▸ `); - const parentOneID = store.getElementIDAtIndex(2); const parentTwoID = store.getElementIDAtIndex(3); - act(() => store.toggleIsCollapsed(parentOneID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -715,7 +834,6 @@ describe('Store (legacy)', () => { ▸
`); - act(() => store.toggleIsCollapsed(parentTwoID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -726,7 +844,6 @@ describe('Store (legacy)', () => { ▾
`); - act(() => store.toggleIsCollapsed(parentOneID, true)); expect(store).toMatchInlineSnapshot(` [root] @@ -736,7 +853,6 @@ describe('Store (legacy)', () => { ▾
`); - act(() => store.toggleIsCollapsed(parentTwoID, true)); expect(store).toMatchInlineSnapshot(` [root] @@ -745,7 +861,6 @@ describe('Store (legacy)', () => { ▸ `); - act(() => store.toggleIsCollapsed(grandparentID, true)); expect(store).toMatchInlineSnapshot(` [root] @@ -760,24 +875,29 @@ describe('Store (legacy)', () => { // one can use an older transform. if (!require('shared/ReactFeatureFlags').enableRefAsProp) { it('should support expanding deep parts of the tree', () => { - const Wrapper = ({forwardedRef}) => ( - - ); + const Wrapper = ({forwardedRef}) => + React.createElement(Nested, { + depth: 3, + forwardedRef: forwardedRef, + }); const Nested = ({depth, forwardedRef}) => - depth > 0 ? ( - - ) : ( -
- ); - + depth > 0 + ? React.createElement(Nested, { + depth: depth - 1, + forwardedRef: forwardedRef, + }) + : React.createElement('div', { + ref: forwardedRef, + }); let ref = null; const refSetter = value => { ref = value; }; - act(() => ReactDOM.render( - , + React.createElement(Wrapper, { + forwardedRef: refSetter, + }), document.createElement('div'), ), ); @@ -785,9 +905,7 @@ describe('Store (legacy)', () => { [root] ▸ `); - const deepestedNodeID = global.agent.getIDForNode(ref); - act(() => store.toggleIsCollapsed(deepestedNodeID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -798,15 +916,12 @@ describe('Store (legacy)', () => { ▾
`); - const rootID = store.getElementIDAtIndex(0); - act(() => store.toggleIsCollapsed(rootID, true)); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => store.toggleIsCollapsed(rootID, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -817,16 +932,13 @@ describe('Store (legacy)', () => { ▾
`); - const id = store.getElementIDAtIndex(1); - act(() => store.toggleIsCollapsed(id, true)); expect(store).toMatchInlineSnapshot(` [root] ▾ `); - act(() => store.toggleIsCollapsed(id, false)); expect(store).toMatchInlineSnapshot(` [root] @@ -839,39 +951,51 @@ describe('Store (legacy)', () => { `); }); } - it('should support reordering of children', () => { - const Root = ({children}) =>
{children}
; - const Component = () =>
; - - const Foo = () =>
{[]}
; - const Bar = () => ( -
{[, ]}
- ); - const foo = ; - const bar = ; - + const Root = ({children}) => React.createElement('div', null, children); + const Component = () => React.createElement('div', null); + const Foo = () => + React.createElement('div', null, [ + React.createElement(Component, { + key: '0', + }), + ]); + const Bar = () => + React.createElement('div', null, [ + React.createElement(Component, { + key: '0', + }), + React.createElement(Component, { + key: '1', + }), + ]); + const foo = React.createElement(Foo, { + key: 'foo', + }); + const bar = React.createElement(Bar, { + key: 'bar', + }); const container = document.createElement('div'); - - act(() => ReactDOM.render({[foo, bar]}, container)); + act(() => + ReactDOM.render(React.createElement(Root, null, [foo, bar]), container), + ); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - - act(() => ReactDOM.render({[bar, foo]}, container)); + act(() => + ReactDOM.render(React.createElement(Root, null, [bar, foo]), container), + ); expect(store).toMatchInlineSnapshot(` [root] ▸ `); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), false)); expect(store).toMatchInlineSnapshot(` [root] ▾
`); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(1), false)); expect(store).toMatchInlineSnapshot(` [root] @@ -880,7 +1004,6 @@ describe('Store (legacy)', () => { ▸ `); - act(() => { store.toggleIsCollapsed(store.getElementIDAtIndex(3), false); store.toggleIsCollapsed(store.getElementIDAtIndex(2), false); @@ -894,7 +1017,6 @@ describe('Store (legacy)', () => { ▾
`); - act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), true)); expect(store).toMatchInlineSnapshot(` [root] @@ -902,14 +1024,11 @@ describe('Store (legacy)', () => { `); }); }); - describe('StrictMode compliance', () => { it('should mark all elements as strict mode compliant', () => { const App = () => null; - const container = document.createElement('div'); - act(() => ReactDOM.render(, container)); - + act(() => ReactDOM.render(React.createElement(App, null), container)); expect(store.getElementAtIndex(0).isStrictModeNonCompliant).toBe(false); }); }); diff --git a/packages/react-devtools-shared/src/devtools/cache.js b/packages/react-devtools-shared/src/devtools/cache.js index cae03a8877f1f..7d0cb7af03311 100644 --- a/packages/react-devtools-shared/src/devtools/cache.js +++ b/packages/react-devtools-shared/src/devtools/cache.js @@ -60,7 +60,7 @@ const Resolved = 1; const Rejected = 2; const ReactSharedInternals = (React: any) - .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function readContext(Context: ReactContext) { const dispatcher = ReactSharedInternals.H; diff --git a/packages/react-dom/client.js b/packages/react-dom/client.js index 1379aaa9d3c53..21aac9369ebb8 100644 --- a/packages/react-dom/client.js +++ b/packages/react-dom/client.js @@ -19,7 +19,7 @@ import type { import { createRoot as createRootImpl, hydrateRoot as hydrateRootImpl, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED as Internals, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE as Internals, } from './'; export function createRoot( diff --git a/packages/react-dom/index.classic.fb.js b/packages/react-dom/index.classic.fb.js index 37a39667a86fc..a565a91f43b1f 100644 --- a/packages/react-dom/index.classic.fb.js +++ b/packages/react-dom/index.classic.fb.js @@ -44,4 +44,4 @@ export { unmountComponentAtNode, } from './src/client/ReactDOMRootFB'; -export {Internals as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}; +export {Internals as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE}; diff --git a/packages/react-dom/index.experimental.js b/packages/react-dom/index.experimental.js index 0d38031e60b21..f2d3c27aea0c5 100644 --- a/packages/react-dom/index.experimental.js +++ b/packages/react-dom/index.experimental.js @@ -7,7 +7,7 @@ * @flow */ -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './src/ReactDOMSharedInternals'; export { createPortal, createRoot, diff --git a/packages/react-dom/index.js b/packages/react-dom/index.js index 4357044d90818..50ad087dfaf6c 100644 --- a/packages/react-dom/index.js +++ b/packages/react-dom/index.js @@ -9,7 +9,7 @@ // Export all exports so that they're available in tests. // We can't use export * from in Flow for some reason. -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './src/ReactDOMSharedInternals'; export { createPortal, createRoot, diff --git a/packages/react-dom/index.modern.fb.js b/packages/react-dom/index.modern.fb.js index f392b0dd9490f..0d2fa4b4dccbd 100644 --- a/packages/react-dom/index.modern.fb.js +++ b/packages/react-dom/index.modern.fb.js @@ -7,7 +7,7 @@ * @flow */ -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternalsFB'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './src/ReactDOMSharedInternalsFB'; export { createPortal, flushSync, diff --git a/packages/react-dom/index.stable.js b/packages/react-dom/index.stable.js index 6da13efa643cd..a9306083c0e61 100644 --- a/packages/react-dom/index.stable.js +++ b/packages/react-dom/index.stable.js @@ -7,7 +7,7 @@ * @flow */ -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './src/ReactDOMSharedInternals'; export { createPortal, createRoot, diff --git a/packages/react-dom/npm/client.js b/packages/react-dom/npm/client.js index bef4756404cfd..af04d9eb2ad9f 100644 --- a/packages/react-dom/npm/client.js +++ b/packages/react-dom/npm/client.js @@ -5,7 +5,7 @@ if (process.env.NODE_ENV === 'production') { exports.createRoot = m.createRoot; exports.hydrateRoot = m.hydrateRoot; } else { - var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + var i = m.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; exports.createRoot = function (c, o) { i.usingClientEntryPoint = true; try { diff --git a/packages/react-dom/server-rendering-stub.js b/packages/react-dom/server-rendering-stub.js index db427710333a5..30f4f80e38903 100644 --- a/packages/react-dom/server-rendering-stub.js +++ b/packages/react-dom/server-rendering-stub.js @@ -13,7 +13,7 @@ import ReactVersion from 'shared/ReactVersion'; export {ReactVersion as version}; -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './src/ReactDOMSharedInternals'; export { createPortal, diff --git a/packages/react-dom/src/ReactDOMServer.js b/packages/react-dom/src/ReactDOMServer.js index 9322ed3c1ba23..01aa77d759cfe 100644 --- a/packages/react-dom/src/ReactDOMServer.js +++ b/packages/react-dom/src/ReactDOMServer.js @@ -8,7 +8,7 @@ */ // This is the subset of APIs that can be accessed from Server Component modules -export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './ReactDOMSharedInternals'; +export {default as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './ReactDOMSharedInternals'; export { prefetchDNS, preconnect, diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 030573a38075d..e098c93ca7a18 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -68,7 +68,7 @@ describe('ReactCompositeComponent', () => { ReactDOM = require('react-dom'); ReactDOMClient = require('react-dom/client'); ReactSharedInternals = - require('react').__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + require('react').__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; Scheduler = require('scheduler'); assertLog = require('internal-test-utils').assertLog; act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactDOM-test.js b/packages/react-dom/src/__tests__/ReactDOM-test.js index 2cb0f24e6944a..e4d7b0ddec658 100644 --- a/packages/react-dom/src/__tests__/ReactDOM-test.js +++ b/packages/react-dom/src/__tests__/ReactDOM-test.js @@ -23,7 +23,8 @@ describe('ReactDOM', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 1d0c3581387da..b72b3da8ced02 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -2121,7 +2121,7 @@ describe('ReactDOMComponent', () => { componentWillUnmount() { // Should not throw expect( - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( this, ).nodeName, ).toBe('SPAN'); diff --git a/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js b/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js index 189bc1d99f423..f6447642bceba 100644 --- a/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMEventListener-test.js @@ -115,14 +115,14 @@ describe('ReactDOMEventListener', () => { }; componentDidMount() { expect( - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( this, ), ).toBe(container.firstChild); } componentDidUpdate() { expect( - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( this, ), ).toBe(container.firstChild); diff --git a/packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js b/packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js index 9725d5fe0fbdc..b81dea9f18263 100644 --- a/packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js @@ -112,7 +112,7 @@ describe('ReactDOMLegacyFiber', () => { ); const textNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( instance, ); expect(textNode).toBe(container.firstChild); @@ -134,7 +134,7 @@ describe('ReactDOMLegacyFiber', () => { expect(container.childNodes.length).toBe(2); const firstNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( instance, ); expect(firstNode).toBe(container.firstChild); @@ -166,7 +166,7 @@ describe('ReactDOMLegacyFiber', () => { expect(container.childNodes.length).toBe(2); const firstNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( instance, ); expect(firstNode).toBe(container.firstChild); @@ -193,7 +193,7 @@ describe('ReactDOMLegacyFiber', () => { expect(container.childNodes.length).toBe(2); const firstNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( instance, ); expect(firstNode).toBe(container.firstChild); @@ -891,7 +891,7 @@ describe('ReactDOMLegacyFiber', () => { const myNodeA = ReactDOM.render(, container); const a = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( myNodeA, ); expect(a.tagName).toBe('DIV'); @@ -900,7 +900,7 @@ describe('ReactDOMLegacyFiber', () => { expect(myNodeA === myNodeB).toBe(true); const b = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode( + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode( myNodeB, ); expect(b.tagName).toBe('SPAN'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js index 464e71ed43f70..e1aeea70fd806 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js @@ -775,7 +775,7 @@ describe('ReactDOMServerHooks', () => { describe('readContext', () => { function readContext(Context) { const dispatcher = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.H; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.H; return dispatcher.readContext(Context); } diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js index 850b52e3be8fb..2e573164a2e16 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js @@ -161,7 +161,8 @@ describe('ReactDOMServerIntegration', () => { itRenders('readContext() in different components', async render => { function readContext(Ctx) { const dispatcher = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.H; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .H; return dispatcher.readContext(Ctx); } diff --git a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js index 12916166ecf0a..69789ad482349 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js @@ -26,7 +26,8 @@ describe('ReactDOMSuspensePlaceholder', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js b/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js index d5274f964c2b5..0cb47904b6f56 100644 --- a/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactEmptyComponent-test.js @@ -27,7 +27,8 @@ describe('ReactEmptyComponent', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; ReactDOMClient = require('react-dom/client'); Scheduler = require('scheduler'); const InternalTestUtils = require('internal-test-utils'); diff --git a/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js index 1f62d9ab20d97..a39fbb0540881 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js @@ -22,7 +22,8 @@ describe('ReactLegacyCompositeComponent', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; ReactDOMClient = require('react-dom/client'); PropTypes = require('prop-types'); act = require('internal-test-utils').act; diff --git a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js index 942191372a3c0..2d539e750cfca 100644 --- a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js @@ -24,7 +24,8 @@ describe('ReactLegacyUpdates', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; act = require('internal-test-utils').act; Scheduler = require('scheduler'); diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.js index 3dd1ca5ac3f8b..d2590e21f7d28 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.js @@ -22,7 +22,7 @@ describe('ReactDOMServer', () => { PropTypes = require('prop-types'); ReactDOMServer = require('react-dom/server'); ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; }); describe('renderToString', () => { diff --git a/packages/react-dom/src/__tests__/ReactUpdates-test.js b/packages/react-dom/src/__tests__/ReactUpdates-test.js index d4acfaa9b35f8..d2a02f7956ec1 100644 --- a/packages/react-dom/src/__tests__/ReactUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactUpdates-test.js @@ -25,7 +25,8 @@ describe('ReactUpdates', () => { React = require('react'); ReactDOM = require('react-dom'); findDOMNode = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode; ReactDOMClient = require('react-dom/client'); act = require('internal-test-utils').act; Scheduler = require('scheduler'); diff --git a/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js b/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js index 28c4cb536d77d..9425ca1dd1f15 100644 --- a/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js +++ b/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js @@ -31,7 +31,8 @@ describe('react-dom-server-rendering-stub', () => { expect(ReactDOM.hydrateRoot).toBe(undefined); expect(ReactDOM.findDOMNode).toBe(undefined); expect( - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.findDOMNode, + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .findDOMNode, ).toBe(null); expect(ReactDOM.hydrate).toBe(undefined); expect(ReactDOM.render).toBe(undefined); diff --git a/packages/react-dom/src/test-utils/ReactTestUtilsFB.js b/packages/react-dom/src/test-utils/ReactTestUtilsFB.js index 0c82865384b9e..ad9a18d58abda 100644 --- a/packages/react-dom/src/test-utils/ReactTestUtilsFB.js +++ b/packages/react-dom/src/test-utils/ReactTestUtilsFB.js @@ -27,7 +27,7 @@ import isArray from 'shared/isArray'; // Keep in sync with ReactDOM.js: const SecretInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const EventInternals = SecretInternals.Events; const getInstanceFromNode = EventInternals[0]; const getNodeFromInstance = EventInternals[1]; diff --git a/packages/react-dom/unstable_testing.classic.fb.js b/packages/react-dom/unstable_testing.classic.fb.js index 9958b22cc3277..db9a26388fb93 100644 --- a/packages/react-dom/unstable_testing.classic.fb.js +++ b/packages/react-dom/unstable_testing.classic.fb.js @@ -26,7 +26,7 @@ export { preinit, preinitModule, version, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, } from './index.classic.fb.js'; export {createRoot, hydrateRoot} from './client.js'; diff --git a/packages/react-dom/unstable_testing.experimental.js b/packages/react-dom/unstable_testing.experimental.js index 2cbd3557cca93..da7aeb1fb1a92 100644 --- a/packages/react-dom/unstable_testing.experimental.js +++ b/packages/react-dom/unstable_testing.experimental.js @@ -20,7 +20,7 @@ export { preinit, preinitModule, version, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, } from './index.experimental.js'; export {createRoot, hydrateRoot} from './client.js'; diff --git a/packages/react-dom/unstable_testing.modern.fb.js b/packages/react-dom/unstable_testing.modern.fb.js index 17e78ae012adc..244d82025105f 100644 --- a/packages/react-dom/unstable_testing.modern.fb.js +++ b/packages/react-dom/unstable_testing.modern.fb.js @@ -21,7 +21,7 @@ export { preinit, preinitModule, version, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, } from './index.modern.fb.js'; export {createRoot, hydrateRoot} from './client.js'; export { diff --git a/packages/react-dom/unstable_testing.stable.js b/packages/react-dom/unstable_testing.stable.js index a0a460ce83a99..59b667fa15a7d 100644 --- a/packages/react-dom/unstable_testing.stable.js +++ b/packages/react-dom/unstable_testing.stable.js @@ -20,6 +20,6 @@ export { preinit, preinitModule, version, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, } from './index.stable.js'; export {createRoot, hydrateRoot} from './client.js'; diff --git a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js index 2b72ddbf726a4..be4119bb797b9 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js @@ -949,7 +949,7 @@ describe('ReactHooks', () => { it('warns when reading context inside useMemo', async () => { const {useMemo, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); function App() { @@ -968,7 +968,7 @@ describe('ReactHooks', () => { it('warns when reading context inside useMemo after reading outside it', async () => { const {useMemo, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); let firstRead, secondRead; @@ -994,7 +994,7 @@ describe('ReactHooks', () => { it('throws when reading context inside useEffect', async () => { const {useEffect, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); function App() { @@ -1015,7 +1015,7 @@ describe('ReactHooks', () => { it('throws when reading context inside useLayoutEffect', async () => { const {useLayoutEffect, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); function App() { @@ -1038,7 +1038,7 @@ describe('ReactHooks', () => { it('warns when reading context inside useReducer', async () => { const {useReducer, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); function App() { @@ -1065,7 +1065,7 @@ describe('ReactHooks', () => { const ThemeContext = createContext('light'); const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; let _setState; function Fn() { @@ -1155,7 +1155,7 @@ describe('ReactHooks', () => { it('resets warning internal state when interrupted by an error', async () => { const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = React.createContext('light'); function App() { @@ -1243,7 +1243,7 @@ describe('ReactHooks', () => { it('warns when reading context inside useMemo', async () => { const {useMemo, createContext} = React; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const ThemeContext = createContext('light'); function App() { diff --git a/packages/react-reconciler/src/__tests__/ReactMemo-test.js b/packages/react-reconciler/src/__tests__/ReactMemo-test.js index 74ef98125b7c9..408629effec5a 100644 --- a/packages/react-reconciler/src/__tests__/ReactMemo-test.js +++ b/packages/react-reconciler/src/__tests__/ReactMemo-test.js @@ -138,7 +138,9 @@ describe('memo', () => { function readContext(Context) { const dispatcher = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.H; + React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE + .H; return dispatcher.readContext(Context); } diff --git a/packages/react-reconciler/src/__tests__/ReactNewContext-test.js b/packages/react-reconciler/src/__tests__/ReactNewContext-test.js index 6f8462607cc06..f5f043f8b7572 100644 --- a/packages/react-reconciler/src/__tests__/ReactNewContext-test.js +++ b/packages/react-reconciler/src/__tests__/ReactNewContext-test.js @@ -49,7 +49,7 @@ describe('ReactNewContext', () => { function readContext(Context) { const dispatcher = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.H; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.H; return dispatcher.readContext(Context); } diff --git a/packages/react-server/src/ReactSharedInternalsServer.js b/packages/react-server/src/ReactSharedInternalsServer.js index cf356f36a5423..8ef67044feca1 100644 --- a/packages/react-server/src/ReactSharedInternalsServer.js +++ b/packages/react-server/src/ReactSharedInternalsServer.js @@ -11,7 +11,7 @@ import * as React from 'react'; const ReactSharedInternalsServer = // $FlowFixMe: It's defined in the one we resolve to. - React.__SECRET_SERVER_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; if (!ReactSharedInternalsServer) { throw new Error( diff --git a/packages/react/index.classic.fb.js b/packages/react/index.classic.fb.js index 00e6ee8a4077e..f38e4ec4a4597 100644 --- a/packages/react/index.classic.fb.js +++ b/packages/react/index.classic.fb.js @@ -8,7 +8,7 @@ */ export { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, act, Children, Component, diff --git a/packages/react/index.experimental.js b/packages/react/index.experimental.js index a7cb3e3cdf4a6..6c594578bfeec 100644 --- a/packages/react/index.experimental.js +++ b/packages/react/index.experimental.js @@ -8,7 +8,7 @@ */ export { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, act, Children, Component, diff --git a/packages/react/index.js b/packages/react/index.js index ba3a705cac28a..6dcbe3a83ef1f 100644 --- a/packages/react/index.js +++ b/packages/react/index.js @@ -29,7 +29,7 @@ export type ChildrenArray<+T> = $ReadOnlyArray> | T; // Export all exports so that they're available in tests. // We can't use export * from in Flow for some reason. export { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, act, Children, Component, diff --git a/packages/react/index.modern.fb.js b/packages/react/index.modern.fb.js index 85a620595188e..fc2bf6dfeaa2a 100644 --- a/packages/react/index.modern.fb.js +++ b/packages/react/index.modern.fb.js @@ -8,7 +8,7 @@ */ export { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, act, Children, Component, diff --git a/packages/react/index.stable.js b/packages/react/index.stable.js index 5e356cf698987..a08110e809bd1 100644 --- a/packages/react/index.stable.js +++ b/packages/react/index.stable.js @@ -8,7 +8,7 @@ */ export { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, act, Children, Component, diff --git a/packages/react/src/ReactClient.js b/packages/react/src/ReactClient.js index 99492359fc7b9..759112f3e8b8b 100644 --- a/packages/react/src/ReactClient.js +++ b/packages/react/src/ReactClient.js @@ -106,7 +106,7 @@ export { cloneElement, isValidElement, ReactVersion as version, - ReactSharedInternals as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + ReactSharedInternals as __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, // Concurrent Mode useTransition, startTransition, diff --git a/packages/react/src/ReactServer.experimental.js b/packages/react/src/ReactServer.experimental.js index c6036c79611ca..50efd138248c0 100644 --- a/packages/react/src/ReactServer.experimental.js +++ b/packages/react/src/ReactServer.experimental.js @@ -10,7 +10,7 @@ // Patch fetch import './ReactFetch'; -export {default as __SECRET_SERVER_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './ReactSharedInternalsServer'; +export {default as __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './ReactSharedInternalsServer'; import {forEach, map, count, toArray, only} from './ReactChildren'; import { diff --git a/packages/react/src/ReactServer.js b/packages/react/src/ReactServer.js index fe1d13e9e5f23..79560c9129ea4 100644 --- a/packages/react/src/ReactServer.js +++ b/packages/react/src/ReactServer.js @@ -10,7 +10,7 @@ // Patch fetch import './ReactFetch'; -export {default as __SECRET_SERVER_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './ReactSharedInternalsServer'; +export {default as __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './ReactSharedInternalsServer'; import {forEach, map, count, toArray, only} from './ReactChildren'; import { diff --git a/packages/scheduler/npm/umd/scheduler.development.js b/packages/scheduler/npm/umd/scheduler.development.js index f7d2e7cd4cf0b..1b9682d8c5372 100644 --- a/packages/scheduler/npm/umd/scheduler.development.js +++ b/packages/scheduler/npm/umd/scheduler.development.js @@ -20,91 +20,91 @@ : (global.Scheduler = factory(global)); })(this, function (global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_scheduleCallback.apply( this, arguments ); } function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_cancelCallback.apply( this, arguments ); } function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_shouldYield.apply( this, arguments ); } function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_requestPaint.apply( this, arguments ); } function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_runWithPriority.apply( this, arguments ); } function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_next.apply( this, arguments ); } function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_wrapCallback.apply( this, arguments ); } function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getCurrentPriorityLevel.apply( this, arguments ); } function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getFirstCallbackNode.apply( this, arguments ); } function unstable_pauseExecution() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_pauseExecution.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_pauseExecution.apply( this, arguments ); } function unstable_continueExecution() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_continueExecution.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_continueExecution.apply( this, arguments ); } function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_forceFrameRate.apply( this, arguments ); @@ -125,27 +125,33 @@ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, unstable_forceFrameRate: unstable_forceFrameRate, get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_IdlePriority; }, get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_ImmediatePriority; }, get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_LowPriority; }, get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_NormalPriority; }, get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_UserBlockingPriority; }, get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_Profiling; }, }); diff --git a/packages/scheduler/npm/umd/scheduler.production.min.js b/packages/scheduler/npm/umd/scheduler.production.min.js index 1a1f5f5ee0b50..e6a5a94fc39a4 100644 --- a/packages/scheduler/npm/umd/scheduler.production.min.js +++ b/packages/scheduler/npm/umd/scheduler.production.min.js @@ -20,70 +20,70 @@ : (global.Scheduler = factory(global)); })(this, function (global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_scheduleCallback.apply( this, arguments ); } function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_cancelCallback.apply( this, arguments ); } function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_shouldYield.apply( this, arguments ); } function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_requestPaint.apply( this, arguments ); } function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_runWithPriority.apply( this, arguments ); } function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_next.apply( this, arguments ); } function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_wrapCallback.apply( this, arguments ); } function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getCurrentPriorityLevel.apply( this, arguments ); } function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getFirstCallbackNode.apply( this, arguments ); @@ -98,7 +98,7 @@ } function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_forceFrameRate.apply( this, arguments ); @@ -119,27 +119,33 @@ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, unstable_forceFrameRate: unstable_forceFrameRate, get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_IdlePriority; }, get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_ImmediatePriority; }, get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_LowPriority; }, get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_NormalPriority; }, get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_UserBlockingPriority; }, get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_Profiling; }, }); diff --git a/packages/scheduler/npm/umd/scheduler.profiling.min.js b/packages/scheduler/npm/umd/scheduler.profiling.min.js index 1a1f5f5ee0b50..e6a5a94fc39a4 100644 --- a/packages/scheduler/npm/umd/scheduler.profiling.min.js +++ b/packages/scheduler/npm/umd/scheduler.profiling.min.js @@ -20,70 +20,70 @@ : (global.Scheduler = factory(global)); })(this, function (global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_scheduleCallback.apply( this, arguments ); } function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_cancelCallback.apply( this, arguments ); } function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_shouldYield.apply( this, arguments ); } function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_requestPaint.apply( this, arguments ); } function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_runWithPriority.apply( this, arguments ); } function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_next.apply( this, arguments ); } function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_wrapCallback.apply( this, arguments ); } function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getCurrentPriorityLevel.apply( this, arguments ); } function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_getFirstCallbackNode.apply( this, arguments ); @@ -98,7 +98,7 @@ } function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( + return global.React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.Scheduler.unstable_forceFrameRate.apply( this, arguments ); @@ -119,27 +119,33 @@ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, unstable_forceFrameRate: unstable_forceFrameRate, get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_IdlePriority; }, get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_ImmediatePriority; }, get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_LowPriority; }, get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_NormalPriority; }, get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_UserBlockingPriority; }, get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED + return global.React + .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE .Scheduler.unstable_Profiling; }, }); diff --git a/packages/shared/ReactDOMSharedInternals.js b/packages/shared/ReactDOMSharedInternals.js index d1cec6cab9785..515628acafe4e 100644 --- a/packages/shared/ReactDOMSharedInternals.js +++ b/packages/shared/ReactDOMSharedInternals.js @@ -10,6 +10,6 @@ import * as ReactDOM from 'react-dom'; const ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; export default ReactDOMSharedInternals; diff --git a/packages/shared/ReactSharedInternals.js b/packages/shared/ReactSharedInternals.js index ebaf4340e4568..02573f9e8c6e6 100644 --- a/packages/shared/ReactSharedInternals.js +++ b/packages/shared/ReactSharedInternals.js @@ -10,6 +10,6 @@ import * as React from 'react'; const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; export default ReactSharedInternals; diff --git a/packages/shared/forks/Scheduler.umd.js b/packages/shared/forks/Scheduler.umd.js index c202753d82520..9bcc8fa9db2f3 100644 --- a/packages/shared/forks/Scheduler.umd.js +++ b/packages/shared/forks/Scheduler.umd.js @@ -9,7 +9,8 @@ import * as React from 'react'; -const ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +const ReactInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; const { unstable_cancelCallback, diff --git a/packages/shared/forks/consoleWithStackDev.www.js b/packages/shared/forks/consoleWithStackDev.www.js index 7c0a40fe2a118..9a1b5e6167d03 100644 --- a/packages/shared/forks/consoleWithStackDev.www.js +++ b/packages/shared/forks/consoleWithStackDev.www.js @@ -35,7 +35,7 @@ function printWarning(level, format, args) { if (__DEV__) { const React = require('react'); const ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. if (ReactSharedInternals != null) { const stack = ReactSharedInternals.getStackAddendum(); diff --git a/scripts/rollup/shims/facebook-www/ReactBrowserEventEmitter_DO_NOT_USE.js b/scripts/rollup/shims/facebook-www/ReactBrowserEventEmitter_DO_NOT_USE.js index f262007ff65ba..38a1171bc2921 100644 --- a/scripts/rollup/shims/facebook-www/ReactBrowserEventEmitter_DO_NOT_USE.js +++ b/scripts/rollup/shims/facebook-www/ReactBrowserEventEmitter_DO_NOT_USE.js @@ -8,8 +8,8 @@ 'use strict'; const { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, } = require('ReactDOM'); module.exports = - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactBrowserEventEmitter; + __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.ReactBrowserEventEmitter;