Skip to content

Commit

Permalink
[Fizz] Move DOM/Native format configs to their respective packages (f…
Browse files Browse the repository at this point in the history
…acebook#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
  • Loading branch information
sebmarkbage authored and zhengjitf committed Mar 23, 2021
1 parent 09a49a6 commit 59a2cf6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
convertStringToBuffer,
} from 'react-server/src/ReactServerStreamConfig';

import escapeTextForBrowser from './escapeTextForBrowser';
import invariant from 'shared/invariant';

// Per response,
Expand Down Expand Up @@ -46,13 +47,11 @@ export function createSuspenseBoundaryID(
}

function encodeHTMLIDAttribute(value: string): string {
// TODO: This needs to be encoded for security purposes.
return value;
return escapeTextForBrowser(value);
}

function encodeHTMLTextNode(text: string): string {
// TOOD: This needs to be encoded for security purposes.
return text;
return escapeTextForBrowser(text);
}

export function pushTextInstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from '../ReactDOMServerFormatConfig';
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from '../ReactDOMServerFormatConfig';
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from '../ReactDOMServerFormatConfig';
export * from 'react-dom/src/server/ReactDOMServerFormatConfig';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

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

0 comments on commit 59a2cf6

Please sign in to comment.