diff --git a/docs/docs/reference-react-dom-node-stream.md b/docs/docs/reference-react-dom-node-stream.md index 54b99541b3c49..d0cc587a3e612 100644 --- a/docs/docs/reference-react-dom-node-stream.md +++ b/docs/docs/reference-react-dom-node-stream.md @@ -14,17 +14,17 @@ Unlike other packages in React, `ReactDOMNodeStream` depends on a package (`stre The `ReactDOMNodeStream` object allows you to render your components in Node.js and stream the resulting markup. - - [`renderToStream()`](#rendertostream) - - [`renderToStaticStream()`](#rendertostaticstream) + - [`renderToNodeStream()`](#rendertonodestream) + - [`renderToStaticNodeStream()`](#rendertostaticnodestream) * * * ## Reference -### `renderToStream()` +### `renderToNodeStream()` ```javascript -ReactDOMNodeStream.renderToStream(element) +ReactDOMNodeStream.renderToNodeStream(element) ``` Render a React element to its initial HTML. This should only be used in Node.js; it will not work in the browser, since the browser does not support Node.js streams. React will return a [Readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) that outputs an HTML string. The HTML output by this stream will be exactly equal to what [`ReactDOMServer.renderToString`](https://facebook.github.io/react/docs/react-dom-server.html#rendertostring) would return. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes. @@ -35,12 +35,12 @@ Note that the stream returned from this method will return a byte stream encoded * * * -### `renderToStaticStream()` +### `renderToStaticNodeStream()` ```javascript -ReactDOMNodeStream.renderToStaticStream(element) +ReactDOMNodeStream.renderToStaticNodeStream(element) ``` -Similar to [`renderToStream`](#rendertostream), except this doesn't create extra DOM attributes such as `data-reactid`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes. +Similar to [`renderToNodeStream`](#rendertonodestream), except this doesn't create extra DOM attributes such as `data-reactid`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes. Note that the stream returned from this method will return a byte stream encoded in utf-8. If you need a stream in another encoding, take a look a project like [iconv-lite](https://www.npmjs.com/package/iconv-lite), which provides transform streams for transcoding text. diff --git a/scripts/error-codes/codes.json b/scripts/error-codes/codes.json index 21accd6d5227f..f075f51e2bee1 100644 --- a/scripts/error-codes/codes.json +++ b/scripts/error-codes/codes.json @@ -204,10 +204,10 @@ "202": "ReactDOM.render(): Invalid component element. Instead of passing a class like Foo, pass React.createElement(Foo) or .", "203": "ReactDOM.render(): Invalid component element. This may be caused by unintentionally loading two independent copies of React.", "204": "ReactDOM.render(): Invalid component element.", - "205": "renderToStream(): Invalid component element.", - "206": "renderToStaticStream(): Invalid component element.", - "207": "ReactDOMServer.renderToStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.", - "208": "ReactDOMServer.renderToStaticStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.", + "205": "renderToNodeStream(): Invalid component element.", + "206": "renderToStaticNodeStream(): Invalid component element.", + "207": "ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.", + "208": "ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.", "209": "renderToString(): Invalid component element.", "210": "renderToStaticMarkup(): Invalid component element.", "211": "Missing injection for fiber findDOMNode", diff --git a/scripts/fiber/tests-passing-except-dev.txt b/scripts/fiber/tests-passing-except-dev.txt index 457b16d592062..8b137891791fe 100644 --- a/scripts/fiber/tests-passing-except-dev.txt +++ b/scripts/fiber/tests-passing-except-dev.txt @@ -1,2 +1 @@ -src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js -* gives source code refs for unknown prop warning for exact elements in composition (ssr) + diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index 3081ea3912aef..6135f4f38c8b5 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -20,9 +20,7 @@ eslint-rules/__tests__/warning-and-invariant-args-test.js * warning(true, 'error!'); * warning(true, '%s %s, %s %s: %s (%s)', 1, 2, 3, 4, 5, 6); -scripts/error-codes/__tests__/replace-invariant-error-codes-test.js -* should replace __DEV__ in if -* should replace warning calls +scripts/error-codes/__tests__/dev-expression-with-codes-test.js * should add `reactProdInvariant` when it finds `require('invariant')` * should replace simple invariant calls * should only add `reactProdInvariant` once @@ -35,6 +33,10 @@ scripts/error-codes/__tests__/invertObject-test.js * should take the last value when there're duplications in vals * should preserve the original order +scripts/rollup/plugins/__tests__/wrap-warning-with-env-check-test.js +* should wrap warning calls +* should not wrap invariant calls + scripts/shared/__tests__/evalToString-test.js * should support StringLiteral * should support string concat (`+`) @@ -336,6 +338,12 @@ src/renderers/__tests__/ReactComponent-test.js * includes owner name in the error about badly-typed elements * throws if a plain object is used as a child * throws if a plain object even if it is in an owner +* throws if a plain object is used as a child when using SSR +* throws if a plain object even if it is in an owner when using SSR +* warns on function as a return value from a function +* warns on function as a return value from a class +* warns on function as a child to host component +* does not warn for function-as-a-child that gets resolved src/renderers/__tests__/ReactComponentLifeCycle-test.js * should not reuse an instance when it has been unmounted @@ -633,6 +641,7 @@ src/renderers/dom/__tests__/ReactDOMProduction-test.js * should use prod fbjs * should use prod React * should handle a simple flow +* should handle a simple flow (ssr) * should call lifecycle methods * should throw with an error code in production * should not crash with devtools installed @@ -715,15 +724,12 @@ src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js * should not remove empty attributes for special properties * should remove for falsey boolean properties * should remove when setting custom attr to null -* should use mutation method where applicable * should set className to empty string instead of null * should remove property properly for boolean properties -* should remove property properly even with different name * should update an empty attribute to zero * should always assign the value attribute for non-inputs * should remove attributes for normal properties * should not remove attributes for special properties -* should not leave all options selected when deleting multiple src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js * should store a listener correctly @@ -855,6 +861,7 @@ src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js * gives source code refs for unknown prop warning for exact elements * gives source code refs for unknown prop warning for exact elements (ssr) * gives source code refs for unknown prop warning for exact elements in composition +* gives source code refs for unknown prop warning for exact elements in composition (ssr) * should suggest property name if available * should suggest property name if available (ssr) * renders innerHTML and preserves whitespace @@ -901,6 +908,41 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * renders a self-closing tag as a child with clean client render * renders a self-closing tag as a child with client render on top of good server markup * renders a self-closing tag as a child with client render on top of bad server markup +* renders a string with server string render +* renders a string with server stream render +* renders a string with clean client render +* renders a string with client render on top of good server markup +* renders a string with client render on top of bad server markup +* renders a number with server string render +* renders a number with server stream render +* renders a number with clean client render +* renders a number with client render on top of good server markup +* renders a number with client render on top of bad server markup +* renders an array with one child with server string render +* renders an array with one child with server stream render +* renders an array with one child with clean client render +* renders an array with one child with client render on top of good server markup +* renders an array with one child with client render on top of bad server markup +* renders an array with several children with server string render +* renders an array with several children with server stream render +* renders an array with several children with clean client render +* renders an array with several children with client render on top of good server markup +* renders an array with several children with client render on top of bad server markup +* renders a nested array with server string render +* renders a nested array with server stream render +* renders a nested array with clean client render +* renders a nested array with client render on top of good server markup +* renders a nested array with client render on top of bad server markup +* renders an iterable with server string render +* renders an iterable with server stream render +* renders an iterable with clean client render +* renders an iterable with client render on top of good server markup +* renders an iterable with client render on top of bad server markup +* renders emptyish values with server string render +* renders emptyish values with server stream render +* renders emptyish values with clean client render +* renders emptyish values with client render on top of good server markup +* renders emptyish values with client render on top of bad server markup * renders simple numbers with server string render * renders simple numbers with server stream render * renders simple numbers with clean client render @@ -1391,6 +1433,11 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * renders a div with a single child surrounded by whitespace with clean client render * renders a div with a single child surrounded by whitespace with client render on top of good server markup * renders a div with a single child surrounded by whitespace with client render on top of bad server markup +* renders a composite with multiple children with server string render +* renders a composite with multiple children with server stream render +* renders a composite with multiple children with clean client render +* renders a composite with multiple children with client render on top of good server markup +* renders a composite with multiple children with client render on top of bad server markup * renders >,<, and & as single child with server string render * renders >,<, and & as single child with server stream render * renders >,<, and & as single child with clean client render @@ -1401,30 +1448,21 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * renders >,<, and & as multiple children with clean client render * renders >,<, and & as multiple children with client render on top of good server markup * renders >,<, and & as multiple children with client render on top of bad server markup -* throws when rendering a string component with server string render -* throws when rendering a string component with clean client render -* throws when rendering a string component with client render on top of bad server markup -* throws when rendering an undefined component with server string render -* throws when rendering an undefined component with clean client render -* throws when rendering an undefined component with client render on top of bad server markup -* throws when rendering a number component with server string render -* throws when rendering a number component with clean client render -* throws when rendering a number component with client render on top of bad server markup -* throws when rendering null with server string render -* throws when rendering null with clean client render -* throws when rendering null with client render on top of bad server markup -* throws when rendering false with server string render -* throws when rendering false with clean client render -* throws when rendering false with client render on top of bad server markup -* throws when rendering undefined with server string render -* throws when rendering undefined with clean client render -* throws when rendering undefined with client render on top of bad server markup -* throws when rendering number with server string render -* throws when rendering number with clean client render -* throws when rendering number with client render on top of bad server markup -* throws when rendering string with server string render -* throws when rendering string with clean client render -* throws when rendering string with client render on top of bad server markup +* throws when rendering a function returning undefined with server string render +* throws when rendering a function returning undefined with clean client render +* throws when rendering a function returning undefined with client render on top of bad server markup +* throws when rendering a class returning undefined with server string render +* throws when rendering a class returning undefined with clean client render +* throws when rendering a class returning undefined with client render on top of bad server markup +* throws when rendering a function returning an object with server string render +* throws when rendering a function returning an object with clean client render +* throws when rendering a function returning an object with client render on top of bad server markup +* throws when rendering a class returning an object with server string render +* throws when rendering a class returning an object with clean client render +* throws when rendering a class returning an object with client render on top of bad server markup +* throws when rendering top-level object with server string render +* throws when rendering top-level object with clean client render +* throws when rendering top-level object with client render on top of bad server markup * renders an input with a value and an onChange with server string render * renders an input with a value and an onChange with server stream render * renders an input with a value and an onChange with clean client render @@ -1694,7 +1732,8 @@ src/renderers/dom/shared/__tests__/ReactMount-test.js * should render different components in same root * should unmount and remount if the key changes * should reuse markup if rendering to the same target twice -* should warn if mounting into dirty rendered markup +* should warn if mounting into left padded rendered markup +* should warn if mounting into right padded rendered markup * should not warn if mounting into non-empty node * should warn when mounting into document.body * should account for escaping on a checksum mismatch @@ -1718,6 +1757,14 @@ src/renderers/dom/shared/__tests__/ReactRenderDocument-test.js * should give helpful errors on state desync * should throw on full document render w/ no markup * supports findDOMNode on full-page components +* should be able to adopt server markup +* should not be able to unmount component from document node +* should not be able to switch root constructors +* should be able to mount into document +* renders over an existing text child without throwing +* should give helpful errors on state desync +* should render w/ no markup to full document +* supports findDOMNode on full-page components src/renderers/dom/shared/__tests__/ReactServerRendering-test.js * should generate simple markup @@ -1726,7 +1773,8 @@ src/renderers/dom/shared/__tests__/ReactServerRendering-test.js * should generate comment markup for component returns null * should render composite components * should only execute certain lifecycle methods -* should have the correct mounting behavior +* should have the correct mounting behavior (old hydrate API) +* should have the correct mounting behavior (new hydrate API) * should throw with silly args * should not put checksum and React ID on components * should not put checksum and React ID on text components @@ -1742,6 +1790,11 @@ src/renderers/dom/shared/__tests__/ReactServerRendering-test.js * warns with a no-op when an async forceUpdate is triggered * should warn when children are mutated during render +src/renderers/dom/shared/__tests__/ReactServerRenderingBrowser-test.js +* provides the same top-level API as react-dom/server +* returns the same results as react-dom/server +* throws meaningfully for server-only APIs + src/renderers/dom/shared/__tests__/escapeTextContentForBrowser-test.js * should escape boolean to string * should escape object to string @@ -2060,29 +2113,6 @@ src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js * should warn if value and defaultValue are specified src/renderers/dom/test/__tests__/ReactTestUtils-test.js -* should call all of the lifecycle hooks -* should only render 1 level deep -* should have shallow rendering -* should enable shouldComponentUpdate to prevent a re-render -* should shallow render a functional component -* should throw for invalid elements -* should have shallow unmounting -* can shallow render to null -* can shallow render with a ref -* lets you update shallowly rendered components -* can access the mounted component instance -* can shallowly render components with contextTypes -* can shallowly render components with ref as function -* can setState in componentWillMount when shallow rendering -* can setState in componentWillReceiveProps when shallow rendering -* can setState with an updater function -* can setState with a callback -* can replaceState with a callback -* can forceUpdate with a callback -* can pass context when shallowly rendering -* should track context across updates -* can fail context when shallowly rendering -* should warn about propTypes (but only once) * can scryRenderedDOMComponentsWithClass with TextComponent * can scryRenderedDOMComponentsWithClass with className contains \n * can scryRenderedDOMComponentsWithClass with multiple classes @@ -2093,7 +2123,6 @@ src/renderers/dom/test/__tests__/ReactTestUtils-test.js * should throw when attempting to use ReactTestUtils.Simulate with shallow rendering * should not warn when simulating events with extra properties * can scry with stateless components involved -* should enable rendering of cloned element * should set the type of the event * should work with renderIntoDocument * should call setState callback with no arguments @@ -2133,7 +2162,7 @@ src/renderers/native/__tests__/createReactNativeComponentClass-test.js * should not allow viewConfigs with duplicate uiViewClassNames to be registered src/renderers/shared/__tests__/ReactDOMFrameScheduling-test.js -* throws when requestAnimationFrame is not polyfilled in the browser +* warns when requestAnimationFrame is not polyfilled in the browser * can import findDOMNode in Node environment src/renderers/shared/__tests__/ReactDebugTool-test.js @@ -2175,6 +2204,10 @@ src/renderers/shared/fiber/__tests__/ReactIncremental-test.js * maintains the correct context when providers bail out due to low priority * maintains the correct context when unwinding due to an error in render * should not recreate masked context unless inputs have changed +* updates descendants with new context values +* updates descendants with multiple context-providing ancestors with new context values +* should not update descendants with new context values if shouldComponentUpdate returns false +* should update descendants with new context values if setState() is called in the middle of the tree src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js * catches render error in a boundary during full deferred mounting @@ -2191,6 +2224,8 @@ src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js * can schedule updates after uncaught error in render on mount * can schedule updates after uncaught error in render on update * can schedule updates after uncaught error during umounting +* should not attempt to recover an unmounting error boundary +* can unmount an error boundary before it is handled * continues work on other roots despite caught errors * continues work on other roots despite uncaught errors * unwinds the context stack correctly on error @@ -2321,6 +2356,18 @@ src/renderers/shared/shared/event/eventPlugins/__tests__/ResponderEventPlugin-te * should negotiate scroll * should cancel correctly +src/renderers/shared/stack/__tests__/PooledClass-test.js +* should initialize a pool correctly +* should return a new instance when the pool is empty +* should return the instance back into the pool when it gets released +* should return an old instance if available in the pool +* should call the destructor when instance gets released +* should accept poolers with different arguments +* should call a new constructor with arguments +* should call an old constructor with arguments +* should throw when the class releases an instance of a different type +* should throw if no destructor is defined + src/renderers/shared/stack/reconciler/__tests__/Transaction-test.js * should invoke closers with/only-with init returns * should invoke closers and wrapped method when inits success @@ -2362,6 +2409,36 @@ src/renderers/shared/utils/__tests__/adler32-test.js * doesn't barf on large inputs * doesn't barf on international inputs +src/renderers/testing/__tests__/ReactShallowRenderer-test.js +* should call all of the lifecycle hooks +* should only render 1 level deep +* should have shallow rendering +* should enable shouldComponentUpdate to prevent a re-render +* should shallow render a functional component +* should shallow render a component returning strings directly from render +* should shallow render a component returning numbers directly from render +* should shallow render a fragment +* should throw for invalid elements +* should have shallow unmounting +* can shallow render to null +* can shallow render with a ref +* lets you update shallowly rendered components +* can access the mounted component instance +* can shallowly render components with contextTypes +* passes expected params to component lifecycle methods +* can shallowly render components with ref as function +* can setState in componentWillMount when shallow rendering +* can setState in componentWillReceiveProps when shallow rendering +* can setState with an updater function +* can setState with a callback +* can replaceState with a callback +* can forceUpdate with a callback +* can pass context when shallowly rendering +* should track context across updates +* can fail context when shallowly rendering +* should warn about propTypes (but only once) +* should enable rendering of cloned element + src/renderers/testing/__tests__/ReactTestRenderer-test.js * renders a simple component * renders a top-level empty component @@ -2387,17 +2464,11 @@ src/renderers/testing/__tests__/ReactTestRenderer-test.js * can update text nodes when rendered as root * can render and update root fragments -src/shared/utils/__tests__/PooledClass-test.js -* should initialize a pool correctly -* should return a new instance when the pool is empty -* should return the instance back into the pool when it gets released -* should return an old instance if available in the pool -* should call the destructor when instance gets released -* should accept poolers with different arguments -* should call a new constructor with arguments -* should call an old constructor with arguments -* should throw when the class releases an instance of a different type -* should throw if no destructor is defined +src/renderers/testing/__tests__/ReactTestRendererTraversal-test.js +* initializes +* searches via .find() / .findAll() +* searches via .findByType() / .findAllByType() +* searches via .findByProps() / .findAllByProps() src/shared/utils/__tests__/reactProdInvariant-test.js * should throw with the correct number of `%s`s in the URL diff --git a/scripts/rollup/results.json b/scripts/rollup/results.json index 4fa903d6371b5..a58eb9c30dcc0 100644 --- a/scripts/rollup/results.json +++ b/scripts/rollup/results.json @@ -1,164 +1,164 @@ { "bundleSizes": { "react.development.js (UMD_DEV)": { - "size": 65928, - "gzip": 16792 + "size": 65905, + "gzip": 16729 }, "react.production.min.js (UMD_PROD)": { - "size": 6361, - "gzip": 2599 + "size": 6359, + "gzip": 2597 }, "react.development.js (NODE_DEV)": { - "size": 56228, - "gzip": 14438 + "size": 56312, + "gzip": 14447 }, "react.production.min.js (NODE_PROD)": { - "size": 5384, - "gzip": 2231 + "size": 5382, + "gzip": 2230 }, "React-dev.js (FB_DEV)": { - "size": 53485, - "gzip": 13653 + "size": 53513, + "gzip": 13663 }, "React-prod.js (FB_PROD)": { - "size": 25016, - "gzip": 6705 + "size": 25014, + "gzip": 6703 }, "react-dom.development.js (UMD_DEV)": { - "size": 624336, - "gzip": 142708 + "size": 635283, + "gzip": 144613 }, "react-dom.production.min.js (UMD_PROD)": { - "size": 114616, - "gzip": 35769 + "size": 108379, + "gzip": 33966 }, "react-dom.development.js (NODE_DEV)": { - "size": 583734, - "gzip": 133055 + "size": 594095, + "gzip": 135122 }, "react-dom.production.min.js (NODE_PROD)": { - "size": 118288, - "gzip": 37153 + "size": 112397, + "gzip": 35476 }, "ReactDOMFiber-dev.js (FB_DEV)": { - "size": 583017, - "gzip": 133083 + "size": 590915, + "gzip": 134583 }, "ReactDOMFiber-prod.js (FB_PROD)": { - "size": 426172, - "gzip": 96450 + "size": 424931, + "gzip": 95294 }, "react-dom-test-utils.development.js (NODE_DEV)": { - "size": 53332, - "gzip": 13396 + "size": 53359, + "gzip": 13402 }, "ReactTestUtils-dev.js (FB_DEV)": { - "size": 53124, - "gzip": 13357 + "size": 53151, + "gzip": 13364 }, "react-dom-unstable-native-dependencies.development.js (UMD_DEV)": { - "size": 84047, - "gzip": 21057 + "size": 88196, + "gzip": 22328 }, "react-dom-unstable-native-dependencies.production.min.js (UMD_PROD)": { - "size": 15672, - "gzip": 5027 + "size": 15149, + "gzip": 4910 }, "react-dom-unstable-native-dependencies.development.js (NODE_DEV)": { - "size": 77475, - "gzip": 19101 + "size": 81733, + "gzip": 20383 }, "react-dom-unstable-native-dependencies.production.min.js (NODE_PROD)": { - "size": 14133, - "gzip": 4451 + "size": 13926, + "gzip": 4403 }, "ReactDOMUnstableNativeDependencies-dev.js (FB_DEV)": { - "size": 77189, - "gzip": 19061 + "size": 81432, + "gzip": 20341 }, "ReactDOMUnstableNativeDependencies-prod.js (FB_PROD)": { - "size": 65908, - "gzip": 15704 + "size": 66066, + "gzip": 15736 }, "react-dom-server.browser.development.js (UMD_DEV)": { - "size": 122873, - "gzip": 31036 + "size": 124076, + "gzip": 31288 }, "react-dom-server.browser.production.min.js (UMD_PROD)": { - "size": 21199, - "gzip": 8114 + "size": 19874, + "gzip": 7592 }, "react-dom-server.browser.development.js (NODE_DEV)": { - "size": 92049, - "gzip": 23628 + "size": 92358, + "gzip": 23695 }, "react-dom-server.browser.production.min.js (NODE_PROD)": { - "size": 19962, - "gzip": 7604 + "size": 18930, + "gzip": 7264 }, "ReactDOMServer-dev.js (FB_DEV)": { - "size": 89559, - "gzip": 23201 + "size": 91551, + "gzip": 23617 }, "ReactDOMServer-prod.js (FB_PROD)": { - "size": 49640, - "gzip": 13644 + "size": 49652, + "gzip": 13866 }, "react-dom-server.node.development.js (NODE_DEV)": { - "size": 94782, - "gzip": 24195 + "size": 95135, + "gzip": 24258 }, "react-dom-server.node.production.min.js (NODE_PROD)": { - "size": 21053, - "gzip": 7964 + "size": 19986, + "gzip": 7613 }, "react-art.development.js (UMD_DEV)": { - "size": 363064, - "gzip": 80610 + "size": 307891, + "gzip": 66652 }, "react-art.production.min.js (UMD_PROD)": { - "size": 88702, - "gzip": 27224 + "size": 47498, + "gzip": 14839 }, "react-art.development.js (NODE_DEV)": { - "size": 284435, - "gzip": 60532 + "size": 295222, + "gzip": 62807 }, "react-art.production.min.js (NODE_PROD)": { - "size": 57226, - "gzip": 17683 + "size": 52520, + "gzip": 16419 }, "ReactARTFiber-dev.js (FB_DEV)": { - "size": 283868, - "gzip": 60453 + "size": 294163, + "gzip": 62866 }, "ReactARTFiber-prod.js (FB_PROD)": { - "size": 217459, - "gzip": 45301 + "size": 220269, + "gzip": 45845 }, "ReactNativeStack-dev.js (RN_DEV)": { - "size": 201024, - "gzip": 37385 + "size": 201067, + "gzip": 37391 }, "ReactNativeStack-prod.js (RN_PROD)": { - "size": 137686, - "gzip": 26481 + "size": 136715, + "gzip": 26222 }, "ReactNativeFiber-dev.js (RN_DEV)": { - "size": 284667, - "gzip": 51712 + "size": 305992, + "gzip": 52996 }, "ReactNativeFiber-prod.js (RN_PROD)": { - "size": 220270, - "gzip": 38503 + "size": 221418, + "gzip": 38321 }, "react-test-renderer.development.js (NODE_DEV)": { - "size": 281620, - "gzip": 59461 + "size": 299690, + "gzip": 63255 }, "ReactTestRendererFiber-dev.js (FB_DEV)": { - "size": 281044, - "gzip": 59382 + "size": 298616, + "gzip": 63330 }, "react-test-renderer-shallow.development.js (NODE_DEV)": { "size": 9556, @@ -169,8 +169,8 @@ "gzip": 2338 }, "react-noop-renderer.development.js (NODE_DEV)": { - "size": 275726, - "gzip": 57882 + "size": 286933, + "gzip": 60117 }, "react-dom-server.development.js (UMD_DEV)": { "size": 120897, diff --git a/src/renderers/dom/ReactDOMNodeStreamRenderer.js b/src/renderers/dom/ReactDOMNodeStreamRenderer.js index 2224527316ca4..7a54db65317d2 100644 --- a/src/renderers/dom/ReactDOMNodeStreamRenderer.js +++ b/src/renderers/dom/ReactDOMNodeStreamRenderer.js @@ -38,36 +38,36 @@ class ReactMarkupReadableStream extends Readable { /** * Render a ReactElement to its initial HTML. This should only be used on the * server. - * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream + * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertonodestream */ -function renderToStream(element) { +function renderToNodeStream(element) { const disableNewFiberFeatures = ReactFeatureFlags.disableNewFiberFeatures; if (disableNewFiberFeatures) { invariant( React.isValidElement(element), - 'renderToStream(): Invalid component element.', + 'renderToNodeStream(): Invalid component element.', ); } return new ReactMarkupReadableStream(element, false); } /** - * Similar to renderToStream, except this doesn't create extra DOM attributes + * Similar to renderToNodeStream, except this doesn't create extra DOM attributes * such as data-react-id that React uses internally. - * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream + * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticnodestream */ -function renderToStaticStream(element) { +function renderToStaticNodeStream(element) { const disableNewFiberFeatures = ReactFeatureFlags.disableNewFiberFeatures; if (disableNewFiberFeatures) { invariant( React.isValidElement(element), - 'renderToStaticStream(): Invalid component element.', + 'renderToStaticNodeStream(): Invalid component element.', ); } return new ReactMarkupReadableStream(element, true); } module.exports = { - renderToStream: renderToStream, - renderToStaticStream: renderToStaticStream, + renderToNodeStream: renderToNodeStream, + renderToStaticNodeStream: renderToStaticNodeStream, }; diff --git a/src/renderers/dom/ReactDOMServerBrowserEntry.js b/src/renderers/dom/ReactDOMServerBrowserEntry.js index cde86ab8b1d85..0b1ecfefa3b4f 100644 --- a/src/renderers/dom/ReactDOMServerBrowserEntry.js +++ b/src/renderers/dom/ReactDOMServerBrowserEntry.js @@ -20,17 +20,17 @@ require('ReactDOMInjection'); module.exports = { renderToString: ReactDOMStringRenderer.renderToString, renderToStaticMarkup: ReactDOMStringRenderer.renderToStaticMarkup, - renderToStream() { + renderToNodeStream() { invariant( false, - 'ReactDOMServer.renderToStream(): The streaming API is not available ' + + 'ReactDOMServer.renderToNodeStream(): The streaming API is not available ' + 'in the browser. Use ReactDOMServer.renderToString() instead.', ); }, - renderToStaticStream() { + renderToStaticNodeStream() { invariant( false, - 'ReactDOMServer.renderToStaticStream(): The streaming API is not available ' + + 'ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available ' + 'in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.', ); }, diff --git a/src/renderers/dom/ReactDOMServerNodeEntry.js b/src/renderers/dom/ReactDOMServerNodeEntry.js index f75fdab33da41..1996b57ee5485 100644 --- a/src/renderers/dom/ReactDOMServerNodeEntry.js +++ b/src/renderers/dom/ReactDOMServerNodeEntry.js @@ -20,7 +20,7 @@ require('ReactDOMInjection'); module.exports = { renderToString: ReactDOMStringRenderer.renderToString, renderToStaticMarkup: ReactDOMStringRenderer.renderToStaticMarkup, - renderToStream: ReactDOMNodeStreamRenderer.renderToStream, - renderToStaticStream: ReactDOMNodeStreamRenderer.renderToStaticStream, + renderToNodeStream: ReactDOMNodeStreamRenderer.renderToNodeStream, + renderToStaticNodeStream: ReactDOMNodeStreamRenderer.renderToStaticNodeStream, version: ReactVersion, }; diff --git a/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js b/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js index 2f7c137cbb161..07143a331448d 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js @@ -119,7 +119,7 @@ async function renderIntoStream(reactElement, errorCount = 0) { () => new Promise(resolve => { let writable = new DrainWritable(); - ReactDOMServer.renderToStream(reactElement).pipe(writable); + ReactDOMServer.renderToNodeStream(reactElement).pipe(writable); writable.on('finish', () => resolve(writable.buffer)); }), errorCount, diff --git a/src/renderers/dom/shared/__tests__/ReactServerRenderingBrowser-test.js b/src/renderers/dom/shared/__tests__/ReactServerRenderingBrowser-test.js index e19c144dcb98f..fa136444a939f 100644 --- a/src/renderers/dom/shared/__tests__/ReactServerRenderingBrowser-test.js +++ b/src/renderers/dom/shared/__tests__/ReactServerRenderingBrowser-test.js @@ -57,12 +57,14 @@ describe('ReactServerRenderingBrowser', () => { if (ReactDOMFeatureFlags.useFiber) { it('throws meaningfully for server-only APIs', () => { - expect(() => ReactDOMServerBrowser.renderToStream(
)).toThrow( - 'ReactDOMServer.renderToStream(): The streaming API is not available ' + + expect(() => ReactDOMServerBrowser.renderToNodeStream(
)).toThrow( + 'ReactDOMServer.renderToNodeStream(): The streaming API is not available ' + 'in the browser. Use ReactDOMServer.renderToString() instead.', ); - expect(() => ReactDOMServerBrowser.renderToStaticStream(
)).toThrow( - 'ReactDOMServer.renderToStaticStream(): The streaming API is not available ' + + expect(() => + ReactDOMServerBrowser.renderToStaticNodeStream(
), + ).toThrow( + 'ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available ' + 'in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.', ); });