mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Add Bun streaming server renderer (#25597)
Add support for Bun server renderer
This commit is contained in:
@@ -447,5 +447,7 @@
|
||||
"459": "Expected a suspended thenable. This is a bug in React. Please file an issue.",
|
||||
"460": "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`",
|
||||
"461": "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue.",
|
||||
"462": "Unexpected SuspendedReason. This is a bug in React."
|
||||
"462": "Unexpected SuspendedReason. This is a bug in React.",
|
||||
"463": "ReactDOMServer.renderToNodeStream(): The Node Stream API is not available in Bun. Use ReactDOMServer.renderToReadableStream() instead.",
|
||||
"464": "ReactDOMServer.renderToStaticNodeStream(): The Node Stream API is not available in Bun. Use ReactDOMServer.renderToReadableStream() instead."
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ const {
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
NODE_PROFILING,
|
||||
BUN_DEV,
|
||||
BUN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
FB_WWW_PROFILING,
|
||||
@@ -200,6 +202,8 @@ function getFormat(bundleType) {
|
||||
case NODE_DEV:
|
||||
case NODE_PROD:
|
||||
case NODE_PROFILING:
|
||||
case BUN_DEV:
|
||||
case BUN_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
case FB_WWW_PROFILING:
|
||||
@@ -223,12 +227,14 @@ function isProductionBundleType(bundleType) {
|
||||
case NODE_ESM:
|
||||
case UMD_DEV:
|
||||
case NODE_DEV:
|
||||
case BUN_DEV:
|
||||
case FB_WWW_DEV:
|
||||
case RN_OSS_DEV:
|
||||
case RN_FB_DEV:
|
||||
return false;
|
||||
case UMD_PROD:
|
||||
case NODE_PROD:
|
||||
case BUN_PROD:
|
||||
case UMD_PROFILING:
|
||||
case NODE_PROFILING:
|
||||
case FB_WWW_PROD:
|
||||
@@ -252,6 +258,8 @@ function isProfilingBundleType(bundleType) {
|
||||
case FB_WWW_PROD:
|
||||
case NODE_DEV:
|
||||
case NODE_PROD:
|
||||
case BUN_DEV:
|
||||
case BUN_PROD:
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
case RN_OSS_DEV:
|
||||
@@ -589,6 +597,7 @@ async function createBundle(bundle, bundleType) {
|
||||
filename,
|
||||
packageName
|
||||
);
|
||||
|
||||
const rollupOutputOptions = getRollupOutputOptions(
|
||||
mainOutputPath,
|
||||
format,
|
||||
@@ -719,6 +728,8 @@ async function buildEverything() {
|
||||
[bundle, NODE_DEV],
|
||||
[bundle, NODE_PROD],
|
||||
[bundle, NODE_PROFILING],
|
||||
[bundle, BUN_DEV],
|
||||
[bundle, BUN_PROD],
|
||||
[bundle, FB_WWW_DEV],
|
||||
[bundle, FB_WWW_PROD],
|
||||
[bundle, FB_WWW_PROFILING],
|
||||
|
||||
@@ -16,6 +16,8 @@ const bundleTypes = {
|
||||
NODE_DEV: 'NODE_DEV',
|
||||
NODE_PROD: 'NODE_PROD',
|
||||
NODE_PROFILING: 'NODE_PROFILING',
|
||||
BUN_DEV: 'BUN_DEV',
|
||||
BUN_PROD: 'BUN_PROD',
|
||||
FB_WWW_DEV: 'FB_WWW_DEV',
|
||||
FB_WWW_PROD: 'FB_WWW_PROD',
|
||||
FB_WWW_PROFILING: 'FB_WWW_PROFILING',
|
||||
@@ -37,6 +39,8 @@ const {
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
NODE_PROFILING,
|
||||
BUN_DEV,
|
||||
BUN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
FB_WWW_PROFILING,
|
||||
@@ -266,6 +270,19 @@ const bundles = [
|
||||
externals: ['react', 'react-dom'],
|
||||
},
|
||||
|
||||
/******* React DOM Fizz Server Bun *******/
|
||||
{
|
||||
bundleTypes: [BUN_DEV, BUN_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-dom/src/server/ReactDOMFizzServerBun.js',
|
||||
name: 'react-dom-server.bun', // 'node_modules/react/*.js',
|
||||
|
||||
global: 'ReactDOMServer',
|
||||
minifyWithProdErrorCodes: false,
|
||||
wrapWithModuleBoundaries: false,
|
||||
externals: ['react', 'react-dom'],
|
||||
},
|
||||
|
||||
/******* React DOM Fizz Static *******/
|
||||
{
|
||||
bundleTypes: __EXPERIMENTAL__ ? [NODE_DEV, NODE_PROD] : [],
|
||||
@@ -955,6 +972,10 @@ function getOriginalFilename(bundle, bundleType) {
|
||||
return `${name}.js`;
|
||||
case NODE_ESM:
|
||||
return `${name}.js`;
|
||||
case BUN_DEV:
|
||||
return `${name}.development.js`;
|
||||
case BUN_PROD:
|
||||
return `${name}.production.min.js`;
|
||||
case UMD_DEV:
|
||||
return `${name}.development.js`;
|
||||
case UMD_PROD:
|
||||
|
||||
@@ -24,6 +24,8 @@ const {
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
NODE_PROFILING,
|
||||
BUN_DEV,
|
||||
BUN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
FB_WWW_PROFILING,
|
||||
@@ -49,6 +51,9 @@ function getBundleOutputPath(bundle, bundleType, filename, packageName) {
|
||||
return `build/node_modules/${packageName}/cjs/${filename}`;
|
||||
case NODE_ESM:
|
||||
return `build/node_modules/${packageName}/esm/${filename}`;
|
||||
case BUN_DEV:
|
||||
case BUN_PROD:
|
||||
return `build/node_modules/${packageName}/cjs/${filename}`;
|
||||
case NODE_DEV:
|
||||
case NODE_PROD:
|
||||
case NODE_PROFILING:
|
||||
|
||||
@@ -13,6 +13,8 @@ const {
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
NODE_PROFILING,
|
||||
BUN_DEV,
|
||||
BUN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
FB_WWW_PROFILING,
|
||||
@@ -75,6 +77,30 @@ ${source}`;
|
||||
${license}
|
||||
*/
|
||||
|
||||
${source}`;
|
||||
},
|
||||
|
||||
/***************** BUN_DEV *****************/
|
||||
[BUN_DEV](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
* @license React
|
||||
* ${filename}
|
||||
*
|
||||
${license}
|
||||
*/
|
||||
|
||||
${source}`;
|
||||
},
|
||||
|
||||
/***************** BUN_PROD *****************/
|
||||
[BUN_PROD](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
* @license React
|
||||
* ${filename}
|
||||
*
|
||||
${license}
|
||||
*/
|
||||
|
||||
${source}`;
|
||||
},
|
||||
|
||||
|
||||
@@ -45,6 +45,25 @@ module.exports = [
|
||||
isFlowTyped: true,
|
||||
isServerSupported: true,
|
||||
},
|
||||
{
|
||||
shortName: 'bun',
|
||||
entryPoints: ['react-dom', 'react-dom/src/server/ReactDOMFizzServerBun.js'],
|
||||
paths: [
|
||||
'react-dom',
|
||||
'react-dom/server',
|
||||
'react-dom/server.bun',
|
||||
'react-dom/src/server/ReactDOMFizzServerBun.js',
|
||||
'react-dom-bindings',
|
||||
'react-dom/server.node',
|
||||
'react-server-dom-webpack',
|
||||
'react-server-dom-webpack/client',
|
||||
'react-server-dom-webpack/server',
|
||||
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
|
||||
'shared/ReactDOMSharedInternals',
|
||||
],
|
||||
isFlowTyped: true,
|
||||
isServerSupported: true,
|
||||
},
|
||||
{
|
||||
shortName: 'dom-browser',
|
||||
entryPoints: [
|
||||
|
||||
Reference in New Issue
Block a user