diff --git a/bench/react-hello-world/react-hello-world.jsx b/bench/react-hello-world/react-hello-world.jsx
index 15f2b000b4..a61ad75673 100644
--- a/bench/react-hello-world/react-hello-world.jsx
+++ b/bench/react-hello-world/react-hello-world.jsx
@@ -1,9 +1,13 @@
-import { renderToReadableStream } from "../../test/bun.js/reactdom-bun.js";
+// to run this:
+// bun react-hello-world.jsx --jsx-production
+// This will become the official react-dom/server.bun build a little later
+// It will be the default when you import from "react-dom/server"
+// That will work via the "bun" package.json export condition (which bun already supports)
+import { renderToReadableStream } from "../../test/bun.js/react-dom-server.bun";
const headers = {
headers: {
"Content-Type": "text/html",
- "Cache-Control": "no-transform", // set to match the Deno benchmark, which requires this for an apples to apples comparison
},
};
@@ -11,12 +15,17 @@ const App = () => (
Hello World
+ This is an example.
);
-export default {
+const port = Number(process.env.PORT || 3001);
+Bun.serve({
+ port,
async fetch(req) {
- return new Response(await renderToReadableStream(), headers);
+ return new Response(await renderToReadableStream());
},
-};
+});
+
+console.log(`Server running on\n http://localhost:${port}`);
diff --git a/test/bun.js/reactdom-bun.js b/test/bun.js/react-dom-server.bun.js
similarity index 99%
rename from test/bun.js/reactdom-bun.js
rename to test/bun.js/react-dom-server.bun.js
index c489314fbe..fc578c8a98 100644
--- a/test/bun.js/reactdom-bun.js
+++ b/test/bun.js/react-dom-server.bun.js
@@ -7,7 +7,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-const escapeHTML = Bun.escapeHTML;
var aa = require("react");
function k(a) {
for (
@@ -200,8 +199,7 @@ Object.keys(z).forEach(function (a) {
});
var ma = /["'&<>]/;
function A(a) {
- if ("boolean" === typeof a || "number" === typeof a) return "" + a;
- return escapeHTML(a);
+ return Bun.escapeHTML(a);
}
var na = /([A-Z])/g,
oa = /^ms-/,
diff --git a/test/bun.js/react-dom.test.tsx b/test/bun.js/react-dom.test.tsx
index d204e88e04..42f4c76317 100644
--- a/test/bun.js/react-dom.test.tsx
+++ b/test/bun.js/react-dom.test.tsx
@@ -10,7 +10,7 @@ import { heapStats } from "bun:jsc";
import { describe, expect, it } from "bun:test";
import { renderToReadableStream as renderToReadableStreamBrowser } from "react-dom/server.browser";
import { gc } from "./gc";
-import { renderToReadableStream as renderToReadableStreamBun } from "./reactdom-bun";
+import { renderToReadableStream as renderToReadableStreamBun } from "./react-dom-server.bun";
import React from "react";
Object.defineProperty(renderToReadableStreamBrowser, "name", {