@tanstack/react-start-client 1.166.16 → 1.166.17
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/dist/esm/renderRSC.js +3 -2
- package/dist/esm/renderRSC.js.map +1 -1
- package/package.json +4 -6
- package/src/renderRSC.tsx +6 -2
package/dist/esm/renderRSC.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isValidElement } from "react";
|
|
2
|
-
import invariant from "
|
|
2
|
+
import { invariant } from "@tanstack/router-core";
|
|
3
3
|
//#region src/renderRSC.tsx
|
|
4
4
|
function renderRsc(input) {
|
|
5
5
|
if (isValidElement(input)) return input;
|
|
6
6
|
if (typeof input === "object" && !input.state) input.state = {
|
|
7
7
|
status: "pending",
|
|
8
8
|
promise: Promise.resolve().then(() => {
|
|
9
|
-
|
|
9
|
+
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: renderRSC() is coming soon!");
|
|
10
|
+
invariant();
|
|
10
11
|
}).then((element) => {
|
|
11
12
|
input.state.value = element;
|
|
12
13
|
input.state.status = "success";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderRSC.js","names":[],"sources":["../../src/renderRSC.tsx"],"sourcesContent":["// TODO: RSCs\nimport { isValidElement } from 'react'\nimport invariant from '
|
|
1
|
+
{"version":3,"file":"renderRSC.js","names":[],"sources":["../../src/renderRSC.tsx"],"sourcesContent":["// TODO: RSCs\nimport { isValidElement } from 'react'\nimport { invariant } from '@tanstack/router-core'\nimport type React from 'react'\n\nexport function renderRsc(input: any): React.JSX.Element {\n if (isValidElement(input)) {\n return input\n }\n\n if (typeof input === 'object' && !input.state) {\n input.state = {\n status: 'pending',\n promise: Promise.resolve()\n .then(() => {\n let element\n\n // We're in node\n // TODO: RSCs\n // if (reactDom.createFromNodeStream) {\n // const stream = await import('node:stream')\n\n // let body: any = input\n\n // // Unwrap the response\n // if (input instanceof Response) {\n // body = input.body\n // }\n\n // // Convert ReadableStream to NodeJS stream.Readable\n // if (body instanceof ReadableStream) {\n // body = stream.Readable.fromWeb(body as any)\n // }\n\n // if (stream.Readable.isReadable(body)) {\n // // body = copyStreamToRaw(body)\n // } else if (input.text) {\n // // create a readable stream by awaiting the text method\n // body = new stream.Readable({\n // async read() {\n // input.text().then((value: any) => {\n // this.push(value)\n // this.push(null)\n // })\n // },\n // })\n // } else {\n // console.error('input', input)\n // throw new Error('Unexpected rsc input type 👆')\n // }\n\n // element = await reactDom.createFromNodeStream(body)\n // } else {\n // // We're in the browser\n // if (input.body instanceof ReadableStream) {\n // input = input.body\n // }\n\n // if (input instanceof ReadableStream) {\n // element = await reactDom.createFromReadableStream(input)\n // }\n\n // if (input instanceof Response) {\n // // copy to the response body to cache the raw data\n // element = await reactDom.createFromFetch(input)\n // }\n // }\n\n // return element\n\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: renderRSC() is coming soon!')\n }\n\n invariant()\n })\n .then((element) => {\n input.state.value = element\n input.state.status = 'success'\n })\n .catch((err) => {\n input.state.status = 'error'\n input.state.error = err\n }),\n }\n }\n\n if (input.state.status === 'pending') {\n throw input.state.promise\n }\n\n return input.state.value\n}\n"],"mappings":";;;AAKA,SAAgB,UAAU,OAA+B;AACvD,KAAI,eAAe,MAAM,CACvB,QAAO;AAGT,KAAI,OAAO,UAAU,YAAY,CAAC,MAAM,MACtC,OAAM,QAAQ;EACZ,QAAQ;EACR,SAAS,QAAQ,SAAS,CACvB,WAAW;AAwDV,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAI,MAAM,gDAAgD;AAGlE,cAAW;IACX,CACD,MAAM,YAAY;AACjB,SAAM,MAAM,QAAQ;AACpB,SAAM,MAAM,SAAS;IACrB,CACD,OAAO,QAAQ;AACd,SAAM,MAAM,SAAS;AACrB,SAAM,MAAM,QAAQ;IACpB;EACL;AAGH,KAAI,MAAM,MAAM,WAAW,UACzB,OAAM,MAAM,MAAM;AAGpB,QAAO,MAAM,MAAM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-start-client",
|
|
3
|
-
"version": "1.166.
|
|
3
|
+
"version": "1.166.17",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,11 +43,9 @@
|
|
|
43
43
|
"node": ">=22.12.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"@tanstack/
|
|
49
|
-
"@tanstack/router-core": "1.168.1",
|
|
50
|
-
"@tanstack/start-client-core": "1.167.1"
|
|
46
|
+
"@tanstack/react-router": "1.168.2",
|
|
47
|
+
"@tanstack/router-core": "1.168.2",
|
|
48
|
+
"@tanstack/start-client-core": "1.167.2"
|
|
51
49
|
},
|
|
52
50
|
"devDependencies": {
|
|
53
51
|
"@testing-library/react": "^16.2.0",
|
package/src/renderRSC.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO: RSCs
|
|
2
2
|
import { isValidElement } from 'react'
|
|
3
|
-
import invariant from '
|
|
3
|
+
import { invariant } from '@tanstack/router-core'
|
|
4
4
|
import type React from 'react'
|
|
5
5
|
|
|
6
6
|
export function renderRsc(input: any): React.JSX.Element {
|
|
@@ -68,7 +68,11 @@ export function renderRsc(input: any): React.JSX.Element {
|
|
|
68
68
|
|
|
69
69
|
// return element
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
+
throw new Error('Invariant failed: renderRSC() is coming soon!')
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
invariant()
|
|
72
76
|
})
|
|
73
77
|
.then((element) => {
|
|
74
78
|
input.state.value = element
|