@pyreon/runtime-server 0.7.11 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/runtime-server",
3
- "version": "0.7.11",
3
+ "version": "0.7.13",
4
4
  "description": "SSR/SSG renderer for Pyreon — streaming HTML + static generation",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "prepublishOnly": "bun run build"
40
40
  },
41
41
  "dependencies": {
42
- "@pyreon/core": "^0.7.11",
43
- "@pyreon/reactivity": "^0.7.11"
42
+ "@pyreon/core": "^0.7.13",
43
+ "@pyreon/reactivity": "^0.7.13"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
@@ -933,3 +933,59 @@ describe("edge-case branches", () => {
933
933
  expect(typeof html).toBe("string")
934
934
  })
935
935
  })
936
+
937
+ // ─── renderToString — Suspense with async components ─────────────────────────
938
+
939
+ describe("renderToString — Suspense async paths", () => {
940
+ test("renderToString with Suspense waits for async component and renders inline", async () => {
941
+ async function AsyncData(): Promise<ReturnType<typeof h>> {
942
+ await new Promise<void>((r) => setTimeout(r, 5))
943
+ return h("p", { id: "content" }, "loaded data")
944
+ }
945
+
946
+ const vnode = h(Suspense, {
947
+ fallback: h("span", null, "loading..."),
948
+ children: h(AsyncData as unknown as ComponentFn, null),
949
+ })
950
+
951
+ const html = await renderToString(vnode)
952
+ // The async content should be present (renderToString awaits async components)
953
+ expect(html).toContain("loaded data")
954
+ })
955
+
956
+ test("renderToString with Suspense where async component throws propagates error", async () => {
957
+ async function FailingComponent(): Promise<ReturnType<typeof h>> {
958
+ await new Promise<void>((r) => setTimeout(r, 1))
959
+ throw new Error("SSR component failure")
960
+ }
961
+
962
+ const vnode = h(Suspense, {
963
+ fallback: h("span", null, "fallback"),
964
+ children: h(FailingComponent as unknown as ComponentFn, null),
965
+ })
966
+
967
+ // renderToString does not catch per-boundary — the error propagates
968
+ await expect(renderToString(vnode)).rejects.toThrow("SSR component failure")
969
+ })
970
+ })
971
+
972
+ describe("renderToStream — Suspense error fallback", () => {
973
+ test("renderToStream keeps fallback visible when async component throws", async () => {
974
+ async function ThrowingChild(): Promise<ReturnType<typeof h>> {
975
+ await new Promise<void>((r) => setTimeout(r, 5))
976
+ throw new Error("stream component error")
977
+ }
978
+
979
+ const vnode = h(Suspense, {
980
+ fallback: h("span", { id: "fb" }, "fallback content"),
981
+ children: h(ThrowingChild as unknown as ComponentFn, null),
982
+ })
983
+
984
+ const html = await collectStream(renderToStream(vnode))
985
+ // Fallback should be present
986
+ expect(html).toContain("fallback content")
987
+ // No swap script invocation should be emitted (error was caught, no template + swap)
988
+ expect(html).not.toContain("pyreon-t-")
989
+ expect(html).not.toContain('__NS("pyreon-s-')
990
+ })
991
+ })