@tanstack/start-client-core 1.132.0-alpha.4 → 1.132.0-alpha.7

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.
@@ -1,4 +1,4 @@
1
1
  type EnvOnlyFn = <TFn extends (...args: Array<any>) => any>(fn: TFn) => TFn;
2
- export declare const serverOnly: EnvOnlyFn;
3
- export declare const clientOnly: EnvOnlyFn;
2
+ export declare const createServerOnlyFn: EnvOnlyFn;
3
+ export declare const createClientOnlyFn: EnvOnlyFn;
4
4
  export {};
@@ -1,7 +1,7 @@
1
- const serverOnly = (fn) => fn;
2
- const clientOnly = (fn) => fn;
1
+ const createServerOnlyFn = (fn) => fn;
2
+ const createClientOnlyFn = (fn) => fn;
3
3
  export {
4
- clientOnly,
5
- serverOnly
4
+ createClientOnlyFn,
5
+ createServerOnlyFn
6
6
  };
7
7
  //# sourceMappingURL=envOnly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"envOnly.js","sources":["../../src/envOnly.ts"],"sourcesContent":["type EnvOnlyFn = <TFn extends (...args: Array<any>) => any>(fn: TFn) => TFn\n\n// A function that will only be available in the server build\n// If called on the client, it will throw an error\nexport const serverOnly: EnvOnlyFn = (fn) => fn\n\n// A function that will only be available in the client build\n// If called on the server, it will throw an error\nexport const clientOnly: EnvOnlyFn = (fn) => fn\n"],"names":[],"mappings":"AAIO,MAAM,aAAwB,CAAC,OAAO;AAItC,MAAM,aAAwB,CAAC,OAAO;"}
1
+ {"version":3,"file":"envOnly.js","sources":["../../src/envOnly.ts"],"sourcesContent":["type EnvOnlyFn = <TFn extends (...args: Array<any>) => any>(fn: TFn) => TFn\n\n// A function that will only be available in the server build\n// If called on the client, it will throw an error\nexport const createServerOnlyFn: EnvOnlyFn = (fn) => fn\n\n// A function that will only be available in the client build\n// If called on the server, it will throw an error\nexport const createClientOnlyFn: EnvOnlyFn = (fn) => fn\n"],"names":[],"mappings":"AAIO,MAAM,qBAAgC,CAAC,OAAO;AAI9C,MAAM,qBAAgC,CAAC,OAAO;"}
@@ -2,7 +2,7 @@ export type { DehydratedRouter, JsonResponse, } from '@tanstack/router-core/ssr/
2
2
  export { hydrate, json, mergeHeaders } from '@tanstack/router-core/ssr/client';
3
3
  export type { Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, SerializerExtensions, } from './serializer.js';
4
4
  export { createIsomorphicFn, type IsomorphicFn, type ServerOnlyFn, type ClientOnlyFn, type IsomorphicFnBase, } from './createIsomorphicFn.js';
5
- export { serverOnly, clientOnly } from './envOnly.js';
5
+ export { createServerOnlyFn, createClientOnlyFn } from './envOnly.js';
6
6
  export { createServerFn } from './createServerFn.js';
7
7
  export { createMiddleware, 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, type AnyRequestMiddleware, } from './createMiddleware.js';
8
8
  export { registerGlobalMiddleware, globalMiddleware, } from './registerGlobalMiddleware.js';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { hydrate, json, mergeHeaders } from "@tanstack/router-core/ssr/client";
2
2
  import { createIsomorphicFn } from "./createIsomorphicFn.js";
3
- import { clientOnly, serverOnly } from "./envOnly.js";
3
+ import { createClientOnlyFn, createServerOnlyFn } from "./envOnly.js";
4
4
  import { applyMiddleware, createServerFn, execValidator, executeMiddleware, flattenMiddlewares, serverFnBaseToMiddleware } from "./createServerFn.js";
5
5
  import { createMiddleware } from "./createMiddleware.js";
6
6
  import { globalMiddleware, registerGlobalMiddleware } from "./registerGlobalMiddleware.js";
@@ -12,11 +12,12 @@ export {
12
12
  TSS_SERVER_FUNCTION,
13
13
  X_TSS_SERIALIZED,
14
14
  applyMiddleware,
15
- clientOnly,
15
+ createClientOnlyFn,
16
16
  createClientRpc,
17
17
  createIsomorphicFn,
18
18
  createMiddleware,
19
19
  createServerFn,
20
+ createServerOnlyFn,
20
21
  execValidator,
21
22
  executeMiddleware,
22
23
  flattenMiddlewares,
@@ -26,7 +27,6 @@ export {
26
27
  json,
27
28
  mergeHeaders,
28
29
  registerGlobalMiddleware,
29
- serverFnBaseToMiddleware,
30
- serverOnly
30
+ serverFnBaseToMiddleware
31
31
  };
32
32
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-client-core",
3
- "version": "1.132.0-alpha.4",
3
+ "version": "1.132.0-alpha.7",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -48,8 +48,8 @@
48
48
  "seroval-plugins": "^1.3.2",
49
49
  "tiny-invariant": "^1.3.3",
50
50
  "tiny-warning": "^1.0.3",
51
- "@tanstack/router-core": "1.132.0-alpha.4",
52
- "@tanstack/start-storage-context": "1.132.0-alpha.4"
51
+ "@tanstack/start-storage-context": "1.132.0-alpha.4",
52
+ "@tanstack/router-core": "1.132.0-alpha.4"
53
53
  },
54
54
  "scripts": {}
55
55
  }
package/src/envOnly.ts CHANGED
@@ -2,8 +2,8 @@ type EnvOnlyFn = <TFn extends (...args: Array<any>) => any>(fn: TFn) => TFn
2
2
 
3
3
  // A function that will only be available in the server build
4
4
  // If called on the client, it will throw an error
5
- export const serverOnly: EnvOnlyFn = (fn) => fn
5
+ export const createServerOnlyFn: EnvOnlyFn = (fn) => fn
6
6
 
7
7
  // A function that will only be available in the client build
8
8
  // If called on the server, it will throw an error
9
- export const clientOnly: EnvOnlyFn = (fn) => fn
9
+ export const createClientOnlyFn: EnvOnlyFn = (fn) => fn
package/src/index.tsx CHANGED
@@ -21,7 +21,7 @@ export {
21
21
  type ClientOnlyFn,
22
22
  type IsomorphicFnBase,
23
23
  } from './createIsomorphicFn'
24
- export { serverOnly, clientOnly } from './envOnly'
24
+ export { createServerOnlyFn, createClientOnlyFn } from './envOnly'
25
25
  export { createServerFn } from './createServerFn'
26
26
  export {
27
27
  createMiddleware,
@@ -1,5 +1,5 @@
1
1
  import { expectTypeOf, test } from 'vitest'
2
- import { clientOnly, serverOnly } from '../envOnly'
2
+ import { createClientOnlyFn, createServerOnlyFn } from '../envOnly'
3
3
 
4
4
  const inputFn = () => 'output'
5
5
 
@@ -11,24 +11,24 @@ function overloadedFn(input: any) {
11
11
  return input
12
12
  }
13
13
 
14
- test("clientOnly returns the function it's given", () => {
15
- const outputFn = clientOnly(inputFn)
14
+ test("createClientOnlyFn returns the function it's given", () => {
15
+ const outputFn = createClientOnlyFn(inputFn)
16
16
  expectTypeOf(outputFn).toEqualTypeOf<typeof inputFn>()
17
17
 
18
- const genericOutputFn = clientOnly(genericInputFn)
18
+ const genericOutputFn = createClientOnlyFn(genericInputFn)
19
19
  expectTypeOf(genericOutputFn).toEqualTypeOf<typeof genericInputFn>()
20
20
 
21
- const overloadedOutputFn = clientOnly(overloadedFn)
21
+ const overloadedOutputFn = createClientOnlyFn(overloadedFn)
22
22
  expectTypeOf(overloadedOutputFn).toEqualTypeOf<typeof overloadedFn>()
23
23
  })
24
24
 
25
- test("serverOnly returns the function it's given", () => {
26
- const outputFn = serverOnly(inputFn)
25
+ test("createServerOnlyFn returns the function it's given", () => {
26
+ const outputFn = createServerOnlyFn(inputFn)
27
27
  expectTypeOf(outputFn).toEqualTypeOf<typeof inputFn>()
28
28
 
29
- const genericOutputFn = serverOnly(genericInputFn)
29
+ const genericOutputFn = createServerOnlyFn(genericInputFn)
30
30
  expectTypeOf(genericOutputFn).toEqualTypeOf<typeof genericInputFn>()
31
31
 
32
- const overloadedOutputFn = serverOnly(overloadedFn)
32
+ const overloadedOutputFn = createServerOnlyFn(overloadedFn)
33
33
  expectTypeOf(overloadedOutputFn).toEqualTypeOf<typeof overloadedFn>()
34
34
  })