@tanstack/start-fn-stubs 1.142.8 → 1.143.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -5,7 +5,7 @@ export interface ServerOnlyFn<TArgs extends Array<any>, TServer> extends Isomorp
5
5
  export interface ClientOnlyFn<TArgs extends Array<any>, TClient> extends IsomorphicFn<TArgs, undefined, TClient> {
6
6
  server: <TServer>(serverImpl: (...args: TArgs) => TServer) => IsomorphicFn<TArgs, TServer, TClient>;
7
7
  }
8
- export interface IsomorphicFnBase extends IsomorphicFn {
8
+ export interface IsomorphicFnBase {
9
9
  server: <TArgs extends Array<any>, TServer>(serverImpl: (...args: TArgs) => TServer) => ServerOnlyFn<TArgs, TServer>;
10
10
  client: <TArgs extends Array<any>, TClient>(clientImpl: (...args: TArgs) => TClient) => ClientOnlyFn<TArgs, TClient>;
11
11
  }
@@ -1,10 +1,11 @@
1
1
  function createIsomorphicFn() {
2
- return {
2
+ const fn = () => void 0;
3
+ return Object.assign(fn, {
3
4
  server: () => ({ client: () => () => {
4
5
  } }),
5
6
  client: () => ({ server: () => () => {
6
7
  } })
7
- };
8
+ });
8
9
  }
9
10
  export {
10
11
  createIsomorphicFn
@@ -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<TArgs extends Array<any>, TServer>\n extends IsomorphicFn<TArgs, TServer> {\n client: <TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface ClientOnlyFn<TArgs extends Array<any>, 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 extends IsomorphicFn {\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 return {\n server: () => ({ client: () => () => {} }),\n client: () => ({ server: () => () => {} }),\n } as any\n}\n"],"names":[],"mappings":"AAmCO,SAAS,qBAAuC;AACrD,SAAO;AAAA,IACL,QAAQ,OAAO,EAAE,QAAQ,MAAM,MAAM;AAAA,IAAC;IACtC,QAAQ,OAAO,EAAE,QAAQ,MAAM,MAAM;AAAA,IAAC,EAAA;AAAA,EAAE;AAE5C;"}
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<TArgs extends Array<any>, TServer>\n extends IsomorphicFn<TArgs, TServer> {\n client: <TClient>(\n clientImpl: (...args: TArgs) => TClient,\n ) => IsomorphicFn<TArgs, TServer, TClient>\n}\n\nexport interface ClientOnlyFn<TArgs extends Array<any>, 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":"AAmCO,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;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-fn-stubs",
3
- "version": "1.142.8",
3
+ "version": "1.143.8",
4
4
  "description": "Stub functions for TanStack Start isomorphic and environment-specific functions",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -21,22 +21,6 @@
21
21
  "server",
22
22
  "client"
23
23
  ],
24
- "scripts": {
25
- "clean": "rimraf ./dist && rimraf ./coverage",
26
- "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
27
- "test:unit": "vitest",
28
- "test:unit:dev": "vitest --watch",
29
- "test:eslint": "eslint ./src",
30
- "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
31
- "test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
32
- "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
33
- "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
34
- "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
35
- "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
36
- "test:types:ts59": "tsc",
37
- "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
38
- "build": "vite build"
39
- },
40
24
  "type": "module",
41
25
  "types": "dist/esm/index.d.ts",
42
26
  "exports": {
@@ -55,5 +39,21 @@
55
39
  ],
56
40
  "engines": {
57
41
  "node": ">=22.12.0"
42
+ },
43
+ "scripts": {
44
+ "clean": "rimraf ./dist && rimraf ./coverage",
45
+ "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
46
+ "test:unit": "vitest",
47
+ "test:unit:dev": "vitest --watch",
48
+ "test:eslint": "eslint ./src",
49
+ "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
50
+ "test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
51
+ "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
52
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
53
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
54
+ "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
55
+ "test:types:ts59": "tsc",
56
+ "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
57
+ "build": "vite build"
58
58
  }
59
- }
59
+ }
@@ -21,7 +21,7 @@ export interface ClientOnlyFn<TArgs extends Array<any>, TClient>
21
21
  ) => IsomorphicFn<TArgs, TServer, TClient>
22
22
  }
23
23
 
24
- export interface IsomorphicFnBase extends IsomorphicFn {
24
+ export interface IsomorphicFnBase {
25
25
  server: <TArgs extends Array<any>, TServer>(
26
26
  serverImpl: (...args: TArgs) => TServer,
27
27
  ) => ServerOnlyFn<TArgs, TServer>
@@ -34,8 +34,9 @@ export interface IsomorphicFnBase extends IsomorphicFn {
34
34
  // if we use `createIsomorphicFn` in this library itself, vite tries to execute it before the transformer runs
35
35
  // therefore we must return a dummy function that allows calling `server` and `client` method chains.
36
36
  export function createIsomorphicFn(): IsomorphicFnBase {
37
- return {
37
+ const fn = () => undefined
38
+ return Object.assign(fn, {
38
39
  server: () => ({ client: () => () => {} }),
39
40
  client: () => ({ server: () => () => {} }),
40
- } as any
41
+ }) as any
41
42
  }