@tanstack/solid-start-client 1.132.0-alpha.9 → 1.132.1
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/StartClient.d.ts +1 -4
- package/dist/esm/StartClient.js +7 -13
- package/dist/esm/StartClient.js.map +1 -1
- package/dist/esm/index.d.ts +1 -3
- package/dist/esm/index.js +2 -13
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/src/StartClient.tsx +6 -10
- package/src/index.tsx +1 -57
- package/dist/esm/useServerFn.d.ts +0 -1
- package/dist/esm/useServerFn.js +0 -24
- package/dist/esm/useServerFn.js.map +0 -1
- package/src/useServerFn.ts +0 -27
package/dist/esm/StartClient.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import { createComponent, memo } from "solid-js/web";
|
|
2
2
|
import { Await, RouterProvider, HeadContent } from "@tanstack/solid-router";
|
|
3
|
-
import {
|
|
3
|
+
import { hydrateStart } from "@tanstack/start-client-core/client";
|
|
4
4
|
let hydrationPromise;
|
|
5
5
|
const Dummy = (props) => memo(() => props.children);
|
|
6
|
-
function StartClient(
|
|
6
|
+
function StartClient() {
|
|
7
7
|
if (!hydrationPromise) {
|
|
8
|
-
|
|
9
|
-
hydrationPromise = hydrate(props.router);
|
|
10
|
-
} else {
|
|
11
|
-
hydrationPromise = Promise.resolve();
|
|
12
|
-
}
|
|
8
|
+
hydrationPromise = hydrateStart();
|
|
13
9
|
}
|
|
14
10
|
return createComponent(Await, {
|
|
15
11
|
promise: hydrationPromise,
|
|
16
|
-
children: () => createComponent(Dummy, {
|
|
12
|
+
children: (router) => createComponent(Dummy, {
|
|
17
13
|
get children() {
|
|
18
14
|
return createComponent(Dummy, {
|
|
19
15
|
get children() {
|
|
20
16
|
return createComponent(RouterProvider, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
InnerWrap: (props2) => createComponent(Dummy, {
|
|
17
|
+
router,
|
|
18
|
+
InnerWrap: (props) => createComponent(Dummy, {
|
|
25
19
|
get children() {
|
|
26
20
|
return [createComponent(Dummy, {
|
|
27
21
|
get children() {
|
|
28
|
-
return [createComponent(HeadContent, {}), memo(() =>
|
|
22
|
+
return [createComponent(HeadContent, {}), memo(() => props.children)];
|
|
29
23
|
}
|
|
30
24
|
}), createComponent(Dummy, {})];
|
|
31
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartClient.js","sources":["../../src/StartClient.tsx"],"sourcesContent":["import { Await, HeadContent, RouterProvider } from '@tanstack/solid-router'\nimport {
|
|
1
|
+
{"version":3,"file":"StartClient.js","sources":["../../src/StartClient.tsx"],"sourcesContent":["import { Await, HeadContent, RouterProvider } from '@tanstack/solid-router'\nimport { hydrateStart } from '@tanstack/start-client-core/client'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { JSXElement } from 'solid-js'\n\nlet hydrationPromise: Promise<AnyRouter> | undefined\n\nconst Dummy = (props: { children?: JSXElement }) => <>{props.children}</>\n\nexport function StartClient() {\n if (!hydrationPromise) {\n hydrationPromise = hydrateStart()\n }\n return (\n <Await\n promise={hydrationPromise}\n children={(router) => (\n <Dummy>\n <Dummy>\n <RouterProvider\n router={router}\n InnerWrap={(props) => (\n <Dummy>\n <Dummy>\n <HeadContent />\n {props.children}\n </Dummy>\n <Dummy />\n </Dummy>\n )}\n />\n </Dummy>\n </Dummy>\n )}\n />\n )\n}\n"],"names":["hydrationPromise","Dummy","props","_$memo","children","StartClient","hydrateStart","_$createComponent","Await","promise","router","RouterProvider","InnerWrap","HeadContent"],"mappings":";;;AAKA,IAAIA;AAEJ,MAAMC,QAAQA,CAACC,UAAgCC,KAAA,MAAQD,MAAME,QAAQ;AAE9D,SAASC,cAAc;AAC5B,MAAI,CAACL,kBAAkB;AACrBA,uBAAmBM,aAAAA;AAAAA,EACrB;AACA,SAAAC,gBACGC,OAAK;AAAA,IACJC,SAAST;AAAAA,IACTI,UAAWM,CAAAA,WAAMH,gBACdN,OAAK;AAAA,MAAA,IAAAG,WAAA;AAAA,eAAAG,gBACHN,OAAK;AAAA,UAAA,IAAAG,WAAA;AAAA,mBAAAG,gBACHI,gBAAc;AAAA,cACbD;AAAAA,cACAE,WAAYV,CAAAA,UAAKK,gBACdN,OAAK;AAAA,gBAAA,IAAAG,WAAA;AAAA,yBAAA,CAAAG,gBACHN,OAAK;AAAA,oBAAA,IAAAG,WAAA;AAAA,6BAAA,CAAAG,gBACHM,aAAW,CAAA,CAAA,GAAAV,KAAA,MACXD,MAAME,QAAQ,CAAA;AAAA,oBAAA;AAAA,kBAAA,CAAA,GAAAG,gBAEhBN,OAAK,CAAA,CAAA,CAAA;AAAA,gBAAA;AAAA,cAAA,CAAA;AAAA,YAAA,CAET;AAAA,UAAA;AAAA,QAAA,CAAA;AAAA,MAAA;AAAA,IAAA,CAAA;AAAA,EAAA,CAIR;AAGP;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export { mergeHeaders, createIsomorphicFn, createServerFn, createMiddleware, registerGlobalMiddleware, globalMiddleware, createServerOnlyFn, createClientOnlyFn, json, createClientRpc, } from '@tanstack/start-client-core';
|
|
2
|
-
export { type DehydratedRouter, type IsomorphicFn, type ServerOnlyFn, type ClientOnlyFn, type IsomorphicFnBase, type CompiledFetcherFnOptions, type CompiledFetcherFn, type Fetcher, type OptionalFetcher, type RequiredFetcher, type RscStream, type FetcherData, type FetcherBaseOptions, type ServerFn, type ServerFnCtx, type ServerFnResponseType, type JsonResponse, type IntersectAllValidatorInputs, type IntersectAllValidatorOutputs, type FunctionMiddlewareServerFn, type AnyFunctionMiddleware, type FunctionMiddlewareOptions, type FunctionMiddlewareWithTypes, type FunctionMiddlewareValidator, type FunctionMiddlewareServer, type FunctionMiddlewareAfterClient, type FunctionMiddlewareAfterServer, type FunctionMiddleware, type FunctionMiddlewareClientFnOptions, type FunctionMiddlewareClientFnResult, type FunctionMiddlewareClientNextFn, type FunctionClientResultWithContext, type AssignAllClientContextBeforeNext, type AssignAllMiddleware, type AssignAllServerContext, type FunctionMiddlewareAfterValidator, type FunctionMiddlewareClientFn, type FunctionMiddlewareServerFnResult, type FunctionMiddlewareClient, type FunctionMiddlewareServerFnOptions, type FunctionMiddlewareServerNextFn, type FunctionServerResultWithContext, } from '@tanstack/start-client-core';
|
|
3
1
|
export { StartClient } from './StartClient.js';
|
|
4
|
-
export {
|
|
2
|
+
export { createClientRpc } from '@tanstack/start-client-core/client';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { createClientOnlyFn, createClientRpc, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, globalMiddleware, json, mergeHeaders, registerGlobalMiddleware } from "@tanstack/start-client-core";
|
|
2
1
|
import { StartClient } from "./StartClient.js";
|
|
3
|
-
import {
|
|
2
|
+
import { createClientRpc } from "@tanstack/start-client-core/client";
|
|
4
3
|
export {
|
|
5
4
|
StartClient,
|
|
6
|
-
|
|
7
|
-
createClientRpc,
|
|
8
|
-
createIsomorphicFn,
|
|
9
|
-
createMiddleware,
|
|
10
|
-
createServerFn,
|
|
11
|
-
createServerOnlyFn,
|
|
12
|
-
globalMiddleware,
|
|
13
|
-
json,
|
|
14
|
-
mergeHeaders,
|
|
15
|
-
registerGlobalMiddleware,
|
|
16
|
-
useServerFn
|
|
5
|
+
createClientRpc
|
|
17
6
|
};
|
|
18
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-start-client",
|
|
3
|
-
"version": "1.132.
|
|
3
|
+
"version": "1.132.1",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"src"
|
|
41
41
|
],
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=12"
|
|
43
|
+
"node": ">=22.12.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"cookie-es": "^1.2.2",
|
|
47
47
|
"tiny-invariant": "^1.3.3",
|
|
48
48
|
"tiny-warning": "^1.0.3",
|
|
49
|
-
"@tanstack/
|
|
50
|
-
"@tanstack/
|
|
51
|
-
"@tanstack/
|
|
49
|
+
"@tanstack/router-core": "1.132.0",
|
|
50
|
+
"@tanstack/solid-router": "1.132.0",
|
|
51
|
+
"@tanstack/start-client-core": "1.132.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@solidjs/testing-library": "^0.8.10",
|
package/src/StartClient.tsx
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { Await, HeadContent, RouterProvider } from '@tanstack/solid-router'
|
|
2
|
-
import {
|
|
2
|
+
import { hydrateStart } from '@tanstack/start-client-core/client'
|
|
3
3
|
import type { AnyRouter } from '@tanstack/router-core'
|
|
4
4
|
import type { JSXElement } from 'solid-js'
|
|
5
5
|
|
|
6
|
-
let hydrationPromise: Promise<
|
|
6
|
+
let hydrationPromise: Promise<AnyRouter> | undefined
|
|
7
7
|
|
|
8
8
|
const Dummy = (props: { children?: JSXElement }) => <>{props.children}</>
|
|
9
9
|
|
|
10
|
-
export function StartClient(
|
|
10
|
+
export function StartClient() {
|
|
11
11
|
if (!hydrationPromise) {
|
|
12
|
-
|
|
13
|
-
hydrationPromise = hydrate(props.router)
|
|
14
|
-
} else {
|
|
15
|
-
hydrationPromise = Promise.resolve()
|
|
16
|
-
}
|
|
12
|
+
hydrationPromise = hydrateStart()
|
|
17
13
|
}
|
|
18
14
|
return (
|
|
19
15
|
<Await
|
|
20
16
|
promise={hydrationPromise}
|
|
21
|
-
children={() => (
|
|
17
|
+
children={(router) => (
|
|
22
18
|
<Dummy>
|
|
23
19
|
<Dummy>
|
|
24
20
|
<RouterProvider
|
|
25
|
-
router={
|
|
21
|
+
router={router}
|
|
26
22
|
InnerWrap={(props) => (
|
|
27
23
|
<Dummy>
|
|
28
24
|
<Dummy>
|
package/src/index.tsx
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
mergeHeaders,
|
|
3
|
-
createIsomorphicFn,
|
|
4
|
-
createServerFn,
|
|
5
|
-
createMiddleware,
|
|
6
|
-
registerGlobalMiddleware,
|
|
7
|
-
globalMiddleware,
|
|
8
|
-
createServerOnlyFn,
|
|
9
|
-
createClientOnlyFn,
|
|
10
|
-
json,
|
|
11
|
-
createClientRpc,
|
|
12
|
-
} from '@tanstack/start-client-core'
|
|
13
|
-
export {
|
|
14
|
-
type DehydratedRouter,
|
|
15
|
-
type IsomorphicFn,
|
|
16
|
-
type ServerOnlyFn,
|
|
17
|
-
type ClientOnlyFn,
|
|
18
|
-
type IsomorphicFnBase,
|
|
19
|
-
type CompiledFetcherFnOptions,
|
|
20
|
-
type CompiledFetcherFn,
|
|
21
|
-
type Fetcher,
|
|
22
|
-
type OptionalFetcher,
|
|
23
|
-
type RequiredFetcher,
|
|
24
|
-
type RscStream,
|
|
25
|
-
type FetcherData,
|
|
26
|
-
type FetcherBaseOptions,
|
|
27
|
-
type ServerFn,
|
|
28
|
-
type ServerFnCtx,
|
|
29
|
-
type ServerFnResponseType,
|
|
30
|
-
type JsonResponse,
|
|
31
|
-
type IntersectAllValidatorInputs,
|
|
32
|
-
type IntersectAllValidatorOutputs,
|
|
33
|
-
type FunctionMiddlewareServerFn,
|
|
34
|
-
type AnyFunctionMiddleware,
|
|
35
|
-
type FunctionMiddlewareOptions,
|
|
36
|
-
type FunctionMiddlewareWithTypes,
|
|
37
|
-
type FunctionMiddlewareValidator,
|
|
38
|
-
type FunctionMiddlewareServer,
|
|
39
|
-
type FunctionMiddlewareAfterClient,
|
|
40
|
-
type FunctionMiddlewareAfterServer,
|
|
41
|
-
type FunctionMiddleware,
|
|
42
|
-
type FunctionMiddlewareClientFnOptions,
|
|
43
|
-
type FunctionMiddlewareClientFnResult,
|
|
44
|
-
type FunctionMiddlewareClientNextFn,
|
|
45
|
-
type FunctionClientResultWithContext,
|
|
46
|
-
type AssignAllClientContextBeforeNext,
|
|
47
|
-
type AssignAllMiddleware,
|
|
48
|
-
type AssignAllServerContext,
|
|
49
|
-
type FunctionMiddlewareAfterValidator,
|
|
50
|
-
type FunctionMiddlewareClientFn,
|
|
51
|
-
type FunctionMiddlewareServerFnResult,
|
|
52
|
-
type FunctionMiddlewareClient,
|
|
53
|
-
type FunctionMiddlewareServerFnOptions,
|
|
54
|
-
type FunctionMiddlewareServerNextFn,
|
|
55
|
-
type FunctionServerResultWithContext,
|
|
56
|
-
} from '@tanstack/start-client-core'
|
|
57
1
|
export { StartClient } from './StartClient'
|
|
58
|
-
export {
|
|
2
|
+
export { createClientRpc } from '@tanstack/start-client-core/client'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(serverFn: T): (...args: Parameters<T>) => ReturnType<T>;
|
package/dist/esm/useServerFn.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { isRedirect } from "@tanstack/router-core";
|
|
2
|
-
import { useRouter } from "@tanstack/solid-router";
|
|
3
|
-
function useServerFn(serverFn) {
|
|
4
|
-
const router = useRouter();
|
|
5
|
-
return async (...args) => {
|
|
6
|
-
try {
|
|
7
|
-
const res = await serverFn(...args);
|
|
8
|
-
if (isRedirect(res)) {
|
|
9
|
-
throw res;
|
|
10
|
-
}
|
|
11
|
-
return res;
|
|
12
|
-
} catch (err) {
|
|
13
|
-
if (isRedirect(err)) {
|
|
14
|
-
err.options._fromLocation = router.state.location;
|
|
15
|
-
return router.navigate(router.resolveRedirect(err).options);
|
|
16
|
-
}
|
|
17
|
-
throw err;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
useServerFn
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=useServerFn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useServerFn.js","sources":["../../src/useServerFn.ts"],"sourcesContent":["import { isRedirect } from '@tanstack/router-core'\nimport { useRouter } from '@tanstack/solid-router'\n\nexport function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(\n serverFn: T,\n): (...args: Parameters<T>) => ReturnType<T> {\n const router = useRouter()\n\n return (async (...args: Array<any>) => {\n try {\n const res = await serverFn(...args)\n\n if (isRedirect(res)) {\n throw res\n }\n\n return res\n } catch (err) {\n if (isRedirect(err)) {\n err.options._fromLocation = router.state.location\n return router.navigate(router.resolveRedirect(err).options)\n }\n\n throw err\n }\n }) as any\n}\n"],"names":[],"mappings":";;AAGO,SAAS,YACd,UAC2C;AAC3C,QAAM,SAAS,UAAA;AAEf,SAAQ,UAAU,SAAqB;AACrC,QAAI;AACF,YAAM,MAAM,MAAM,SAAS,GAAG,IAAI;AAElC,UAAI,WAAW,GAAG,GAAG;AACnB,cAAM;AAAA,MACR;AAEA,aAAO;AAAA,IACT,SAAS,KAAK;AACZ,UAAI,WAAW,GAAG,GAAG;AACnB,YAAI,QAAQ,gBAAgB,OAAO,MAAM;AACzC,eAAO,OAAO,SAAS,OAAO,gBAAgB,GAAG,EAAE,OAAO;AAAA,MAC5D;AAEA,YAAM;AAAA,IACR;AAAA,EACF;AACF;"}
|
package/src/useServerFn.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { isRedirect } from '@tanstack/router-core'
|
|
2
|
-
import { useRouter } from '@tanstack/solid-router'
|
|
3
|
-
|
|
4
|
-
export function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(
|
|
5
|
-
serverFn: T,
|
|
6
|
-
): (...args: Parameters<T>) => ReturnType<T> {
|
|
7
|
-
const router = useRouter()
|
|
8
|
-
|
|
9
|
-
return (async (...args: Array<any>) => {
|
|
10
|
-
try {
|
|
11
|
-
const res = await serverFn(...args)
|
|
12
|
-
|
|
13
|
-
if (isRedirect(res)) {
|
|
14
|
-
throw res
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return res
|
|
18
|
-
} catch (err) {
|
|
19
|
-
if (isRedirect(err)) {
|
|
20
|
-
err.options._fromLocation = router.state.location
|
|
21
|
-
return router.navigate(router.resolveRedirect(err).options)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
throw err
|
|
25
|
-
}
|
|
26
|
-
}) as any
|
|
27
|
-
}
|