Skip to content

Commit

Permalink
Rename DOM Internals
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 9, 2024
1 parent 9feaa46 commit 0f62703
Show file tree
Hide file tree
Showing 26 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/react-dom/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/index.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
2 changes: 1 addition & 1 deletion packages/react-dom/index.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/index.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/index.stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/npm/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/server-rendering-stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/ReactDOMServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/react-dom/src/__tests__/ReactDOM-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -891,7 +891,7 @@ describe('ReactDOMLegacyFiber', () => {

const myNodeA = ReactDOM.render(<MyNode />, 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');
Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion packages/react-dom/src/__tests__/ReactEmptyComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
3 changes: 2 additions & 1 deletion packages/react-dom/src/__tests__/ReactUpdates-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/test-utils/ReactTestUtilsFB.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/unstable_testing.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/unstable_testing.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/unstable_testing.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/unstable_testing.stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion packages/shared/ReactDOMSharedInternals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 0f62703

Please sign in to comment.