Skip to content

Commit 14e4fd1

Browse files
authored
[Fizz] Move DOM/Native format configs to their respective packages (#20994)
* Move DOM/Native format configs to their respective packages The streaming configs (Node/Browser) are different because they operate at another dimension that exists in each package. * Use escapeTextForBrowser to encode dynamic strings We can now use local dependencies
1 parent f2b6bf7 commit 14e4fd1

6 files changed

+7
-8
lines changed

packages/react-server/src/ReactDOMServerFormatConfig.js packages/react-dom/src/server/ReactDOMServerFormatConfig.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
convertStringToBuffer,
1515
} from 'react-server/src/ReactServerStreamConfig';
1616

17+
import escapeTextForBrowser from './escapeTextForBrowser';
1718
import invariant from 'shared/invariant';
1819

1920
// Per response,
@@ -46,13 +47,11 @@ export function createSuspenseBoundaryID(
4647
}
4748

4849
function encodeHTMLIDAttribute(value: string): string {
49-
// TODO: This needs to be encoded for security purposes.
50-
return value;
50+
return escapeTextForBrowser(value);
5151
}
5252

5353
function encodeHTMLTextNode(text: string): string {
54-
// TOOD: This needs to be encoded for security purposes.
55-
return text;
54+
return escapeTextForBrowser(text);
5655
}
5756

5857
export function pushTextInstance(

packages/react-server/src/forks/ReactServerFormatConfig.dom-browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
* @flow
88
*/
99

10-
export * from '../ReactDOMServerFormatConfig';
10+
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';

packages/react-server/src/forks/ReactServerFormatConfig.dom-relay.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
* @flow
88
*/
99

10-
export * from '../ReactDOMServerFormatConfig';
10+
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';

packages/react-server/src/forks/ReactServerFormatConfig.dom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
* @flow
88
*/
99

10-
export * from '../ReactDOMServerFormatConfig';
10+
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';

packages/react-server/src/forks/ReactServerFormatConfig.native-relay.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
* @flow
88
*/
99

10-
export * from '../ReactNativeServerFormatConfig';
10+
export * from 'react-native-renderer/src/server/ReactNativeServerFormatConfig';

0 commit comments

Comments
 (0)