@tanstack/start-fn-stubs 1.161.4 → 1.161.6

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,13 +1,12 @@
1
+ //#region src/createIsomorphicFn.ts
1
2
  function createIsomorphicFn() {
2
- const fn = () => void 0;
3
- return Object.assign(fn, {
4
- server: () => ({ client: () => () => {
5
- } }),
6
- client: () => ({ server: () => () => {
7
- } })
8
- });
3
+ const fn = () => void 0;
4
+ return Object.assign(fn, {
5
+ server: () => ({ client: () => () => {} }),
6
+ client: () => ({ server: () => () => {} })
7
+ });
9
8
  }
10
- export {
11
- createIsomorphicFn
12
- };
13
- //# sourceMappingURL=createIsomorphicFn.js.map
9
+ //#endregion
10
+ export { createIsomorphicFn };
11
+
12
+ //# sourceMappingURL=createIsomorphicFn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createIsomorphicFn.js","sources":["../../src/createIsomorphicFn.ts"],"sourcesContent":["// a function that can have different implementations on the client and server.\n// implementations not provided will default to a no-op function.\n\nexport type IsomorphicFn<\n TArgs extends Array<any> = [],\n TServer = undefined,\n TClient = undefined,\n> = (...args: TArgs) => TServer | TClient\n\nexport interface ServerOnlyFn<\n TArgs extends Array<any>,\n TServer,\n> extends IsomorphicFn<TArgs, TServer> {\n client: <TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface ClientOnlyFn<\n TArgs extends Array<any>,\n TClient,\n> extends IsomorphicFn<TArgs, undefined, TClient> {\n server: <TServer>(\n serverImpl: (...args: TArgs) => TServer,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface IsomorphicFnBase {\n server: <TArgs extends Array<any>, TServer>(\n serverImpl: (...args: TArgs) => TServer,\n ) => ServerOnlyFn<TArgs, TServer>\n client: <TArgs extends Array<any>, TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => ClientOnlyFn<TArgs, TClient>\n}\n\n// this is a dummy function, it will be replaced by the transformer\n// if we use `createIsomorphicFn` in this library itself, vite tries to execute it before the transformer runs\n// therefore we must return a dummy function that allows calling `server` and `client` method chains.\nexport function createIsomorphicFn(): IsomorphicFnBase {\n const fn = () => undefined\n return Object.assign(fn, {\n server: () => ({ client: () => () => {} }),\n client: () => ({ server: () => () => {} }),\n }) as any\n}\n"],"names":[],"mappings":"AAuCO,SAAS,qBAAuC;AACrD,QAAM,KAAK,MAAM;AACjB,SAAO,OAAO,OAAO,IAAI;AAAA,IACvB,QAAQ,OAAO,EAAE,QAAQ,MAAM,MAAM;AAAA,IAAC;IACtC,QAAQ,OAAO,EAAE,QAAQ,MAAM,MAAM;AAAA,IAAC,EAAA;AAAA,EAAE,CACzC;AACH;"}
1
+ {"version":3,"file":"createIsomorphicFn.js","names":[],"sources":["../../src/createIsomorphicFn.ts"],"sourcesContent":["// a function that can have different implementations on the client and server.\n// implementations not provided will default to a no-op function.\n\nexport type IsomorphicFn<\n TArgs extends Array<any> = [],\n TServer = undefined,\n TClient = undefined,\n> = (...args: TArgs) => TServer | TClient\n\nexport interface ServerOnlyFn<\n TArgs extends Array<any>,\n TServer,\n> extends IsomorphicFn<TArgs, TServer> {\n client: <TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface ClientOnlyFn<\n TArgs extends Array<any>,\n TClient,\n> extends IsomorphicFn<TArgs, undefined, TClient> {\n server: <TServer>(\n serverImpl: (...args: TArgs) => TServer,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface IsomorphicFnBase {\n server: <TArgs extends Array<any>, TServer>(\n serverImpl: (...args: TArgs) => TServer,\n ) => ServerOnlyFn<TArgs, TServer>\n client: <TArgs extends Array<any>, TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => ClientOnlyFn<TArgs, TClient>\n}\n\n// this is a dummy function, it will be replaced by the transformer\n// if we use `createIsomorphicFn` in this library itself, vite tries to execute it before the transformer runs\n// therefore we must return a dummy function that allows calling `server` and `client` method chains.\nexport function createIsomorphicFn(): IsomorphicFnBase {\n const fn = () => undefined\n return Object.assign(fn, {\n server: () => ({ client: () => () => {} }),\n client: () => ({ server: () => () => {} }),\n }) as any\n}\n"],"mappings":";AAuCA,SAAgB,qBAAuC;CACrD,MAAM,WAAW,KAAA;AACjB,QAAO,OAAO,OAAO,IAAI;EACvB,eAAe,EAAE,oBAAoB,IAAI;EACzC,eAAe,EAAE,oBAAoB,IAAI;EAC1C,CAAC"}
@@ -1,7 +1,7 @@
1
- const createServerOnlyFn = (fn) => fn;
2
- const createClientOnlyFn = (fn) => fn;
3
- export {
4
- createClientOnlyFn,
5
- createServerOnlyFn
6
- };
7
- //# sourceMappingURL=envOnly.js.map
1
+ //#region src/envOnly.ts
2
+ var createServerOnlyFn = (fn) => fn;
3
+ var createClientOnlyFn = (fn) => fn;
4
+ //#endregion
5
+ export { createClientOnlyFn, createServerOnlyFn };
6
+
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 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;"}
1
+ {"version":3,"file":"envOnly.js","names":[],"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"],"mappings":";AAIA,IAAa,sBAAiC,OAAO;AAIrD,IAAa,sBAAiC,OAAO"}
package/dist/esm/index.js CHANGED
@@ -1,8 +1,3 @@
1
1
  import { createIsomorphicFn } from "./createIsomorphicFn.js";
2
2
  import { createClientOnlyFn, createServerOnlyFn } from "./envOnly.js";
3
- export {
4
- createClientOnlyFn,
5
- createIsomorphicFn,
6
- createServerOnlyFn
7
- };
8
- //# sourceMappingURL=index.js.map
3
+ export { createClientOnlyFn, createIsomorphicFn, createServerOnlyFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-fn-stubs",
3
- "version": "1.161.4",
3
+ "version": "1.161.6",
4
4
  "description": "Stub functions for TanStack Start isomorphic and environment-specific functions",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}