mirror of
https://github.com/facebook/react.git
synced 2026-02-25 13:13:03 +00:00
We currently abuse the browser builds for Web streams derived environments. We already have a special build for Bun but we should also have one for [other "edge" runtimes](https://runtime-keys.proposal.wintercg.org/) so that we can maximally take advantage of the APIs that exist on each platform. In practice, we currently check for a global property called `AsyncLocalStorage` in the server browser builds which we shouldn't really do since browsers likely won't ever have it. Additionally, this should probably move to an import which we can't add to actual browser builds where that will be an invalid import. So it has to be a separate build. That's not done yet in this PR but Vercel will follow Cloudflare's lead here. The `deno` key still points to the browser build since there's no AsyncLocalStorage there but it could use this same or a custom build if support is added.
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
// This file is only used for tests.
|
|
// It lazily loads the implementation so that we get the correct set of host configs.
|
|
|
|
import ReactVersion from 'shared/ReactVersion';
|
|
export {ReactVersion as version};
|
|
|
|
export function renderToReadableStream() {
|
|
return require('./src/server/ReactDOMFizzServerEdge').renderToReadableStream.apply(
|
|
this,
|
|
arguments,
|
|
);
|
|
}
|
|
|
|
export function renderToNodeStream() {
|
|
return require('./src/server/ReactDOMFizzServerEdge').renderToNodeStream.apply(
|
|
this,
|
|
arguments,
|
|
);
|
|
}
|
|
|
|
export function renderToStaticNodeStream() {
|
|
return require('./src/server/ReactDOMFizzServerEdge').renderToStaticNodeStream.apply(
|
|
this,
|
|
arguments,
|
|
);
|
|
}
|
|
|
|
export function renderToString() {
|
|
return require('./src/server/ReactDOMLegacyServerBrowser').renderToString.apply(
|
|
this,
|
|
arguments,
|
|
);
|
|
}
|
|
|
|
export function renderToStaticMarkup() {
|
|
return require('./src/server/ReactDOMLegacyServerBrowser').renderToStaticMarkup.apply(
|
|
this,
|
|
arguments,
|
|
);
|
|
}
|