@hyper-fetch/hono 0.0.0-stage → 1.0.0
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.md +111 -0
- package/README.md +127 -2
- package/dist/hono.types.d.ts +74 -0
- package/dist/hono.types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +0 -0
- package/package.json +59 -4
package/License.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
|
|
2
|
+
|
|
3
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
4
|
+
|
|
5
|
+
1. Definitions.
|
|
6
|
+
|
|
7
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9
|
|
8
|
+
of this document.
|
|
9
|
+
|
|
10
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
11
|
+
|
|
12
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are
|
|
13
|
+
under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or
|
|
14
|
+
indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of
|
|
15
|
+
fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code,
|
|
20
|
+
documentation source, and configuration files.
|
|
21
|
+
|
|
22
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including
|
|
23
|
+
but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
24
|
+
|
|
25
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as
|
|
26
|
+
indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix
|
|
27
|
+
below).
|
|
28
|
+
|
|
29
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work
|
|
30
|
+
and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an
|
|
31
|
+
original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain
|
|
32
|
+
separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
33
|
+
|
|
34
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or
|
|
35
|
+
additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the
|
|
36
|
+
Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
|
|
37
|
+
For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to
|
|
38
|
+
the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code
|
|
39
|
+
control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of
|
|
40
|
+
discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in
|
|
41
|
+
writing by the copyright owner as "Not a Contribution."
|
|
42
|
+
|
|
43
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received
|
|
44
|
+
by Licensor and subsequently incorporated within the Work.
|
|
45
|
+
|
|
46
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to
|
|
47
|
+
You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce,
|
|
48
|
+
prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
49
|
+
Derivative Works in Source or Object form.
|
|
50
|
+
|
|
51
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
|
52
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
|
53
|
+
license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license
|
|
54
|
+
applies only to those patent claims licensable by such Contributor that are necessarily infringed by their
|
|
55
|
+
Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was
|
|
56
|
+
submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a
|
|
57
|
+
lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory
|
|
58
|
+
patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of
|
|
59
|
+
the date such litigation is filed.
|
|
60
|
+
|
|
61
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
|
62
|
+
or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
63
|
+
|
|
64
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any
|
|
65
|
+
modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of
|
|
66
|
+
any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form
|
|
67
|
+
of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a
|
|
68
|
+
"NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable
|
|
69
|
+
copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any
|
|
70
|
+
part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of
|
|
71
|
+
the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a
|
|
72
|
+
display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the
|
|
73
|
+
NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices
|
|
74
|
+
within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that
|
|
75
|
+
such additional attribution notices cannot be construed as modifying the License.
|
|
76
|
+
|
|
77
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and
|
|
78
|
+
conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
79
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this
|
|
80
|
+
License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
81
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
|
82
|
+
additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any
|
|
83
|
+
separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
84
|
+
|
|
85
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product
|
|
86
|
+
names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
|
|
87
|
+
reproducing the content of the NOTICE file.
|
|
88
|
+
|
|
89
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and
|
|
90
|
+
each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
91
|
+
either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
|
92
|
+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness
|
|
93
|
+
of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this
|
|
94
|
+
License.
|
|
95
|
+
|
|
96
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or
|
|
97
|
+
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing,
|
|
98
|
+
shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or
|
|
99
|
+
consequential damages of any character arising as a result of this License or out of the use or inability to use the
|
|
100
|
+
Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
101
|
+
any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such
|
|
102
|
+
damages.
|
|
103
|
+
|
|
104
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose
|
|
105
|
+
to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or
|
|
106
|
+
rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and
|
|
107
|
+
on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and
|
|
108
|
+
hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason
|
|
109
|
+
of your accepting any such warranty or additional liability.
|
|
110
|
+
|
|
111
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🏯 Hyper Fetch Hono
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<b>Call your Hono backend from a fully typed HyperFetch SDK. No codegen, no duplicated types.</b>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/BetterTyped/hyper-fetch">
|
|
9
|
+
<img src="https://img.shields.io/github/stars/BetterTyped/hyper-fetch?logo=github&color=118ab2" alt="GitHub stars" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@hyper-fetch/hono">
|
|
12
|
+
<img src="https://img.shields.io/npm/v/@hyper-fetch/hono?logo=npm&color=e76f51" alt="npm version" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@hyper-fetch/hono">
|
|
15
|
+
<img src="https://img.shields.io/npm/dm/@hyper-fetch/hono?logo=npm" alt="npm downloads" />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://bundlephobia.com/package/@hyper-fetch/hono">
|
|
18
|
+
<img src="https://img.shields.io/bundlephobia/minzip/@hyper-fetch/hono?color=64BC4B" alt="bundle size" />
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/BetterTyped/hyper-fetch/blob/main/License.md">
|
|
21
|
+
<img src="https://img.shields.io/github/license/BetterTyped/hyper-fetch?color=yellow" alt="license" />
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://github.com/BetterTyped/hyper-fetch">
|
|
24
|
+
<img src="https://img.shields.io/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://hono.dev/">
|
|
27
|
+
<img src="https://img.shields.io/badge/hono-E36002?logo=hono&logoColor=white" alt="Hono" />
|
|
28
|
+
</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
## 📖 About
|
|
32
|
+
|
|
33
|
+
`@hyper-fetch/hono` turns the type of a Hono app into a HyperFetch SDK schema. Your frontend calls the backend through
|
|
34
|
+
`createSdk` with response, payload, query and param types read straight from your Hono routes and validators. It ships
|
|
35
|
+
types only, so nothing from your server ends up in the client bundle.
|
|
36
|
+
|
|
37
|
+
## 🎯 Key Capabilities
|
|
38
|
+
|
|
39
|
+
- 🔗 **Backend types, frontend calls** - Change a Hono route and every SDK call that uses it fails to compile
|
|
40
|
+
- 🧭 **Paths become properties** - `/users/:userId/posts` is `sdk.users.$userId.posts.$get`, with typed `setParams()`
|
|
41
|
+
- 🛂 **Validators drive the payload** - `json` and `query` validators type `setPayload()` and `setQueryParams()`
|
|
42
|
+
- 🧩 **Mounted routers included** - `app.route()` and `basePath()` prefixes land in the endpoint and the nesting
|
|
43
|
+
- 🪶 **Zero runtime** - A single type export, so it adds no code to your bundle
|
|
44
|
+
- ⚡ **Every HyperFetch feature** - Cache, retries, deduplication, offline and React hooks work on every route
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install @hyper-fetch/core @hyper-fetch/hono
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// backend
|
|
54
|
+
import { Hono } from "hono";
|
|
55
|
+
import type { HonoAppToHyperFetch } from "@hyper-fetch/hono";
|
|
56
|
+
|
|
57
|
+
const app = new Hono().get("/users/:userId", (c) => c.json({ id: c.req.param("userId"), name: "Ann" }));
|
|
58
|
+
|
|
59
|
+
export type AppSchema = HonoAppToHyperFetch<typeof app>;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// frontend
|
|
64
|
+
import { createClient, createSdk } from "@hyper-fetch/core";
|
|
65
|
+
import type { AppSchema } from "@my-app/backend";
|
|
66
|
+
|
|
67
|
+
const client = createClient({ url: "https://api.example.com" });
|
|
68
|
+
const sdk = createSdk<typeof client, AppSchema>(client);
|
|
69
|
+
|
|
70
|
+
const { data } = await sdk.users.$userId.$get.setParams({ userId: "1" }).send();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 📚 Documentation
|
|
74
|
+
|
|
75
|
+
- [Hono Integration Docs](https://hyperfetch.bettertyped.com/docs/integrations/hono/overview)
|
|
76
|
+
- [SDK Guide](https://hyperfetch.bettertyped.com/docs/core/sdk)
|
|
77
|
+
- [Getting Started](https://hyperfetch.bettertyped.com/docs/getting-started/quick-start)
|
|
78
|
+
|
|
79
|
+
## 💡 Examples
|
|
80
|
+
|
|
81
|
+
### Mounted routers with validators
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { Hono } from "hono";
|
|
85
|
+
import { validator } from "hono/validator";
|
|
86
|
+
import type { HonoAppToHyperFetch } from "@hyper-fetch/hono";
|
|
87
|
+
|
|
88
|
+
const users = new Hono()
|
|
89
|
+
.get("/", (c) => c.json([{ id: "1", name: "Ann" }]))
|
|
90
|
+
.post(
|
|
91
|
+
"/",
|
|
92
|
+
validator("json", (value: { name: string }) => value),
|
|
93
|
+
(c) => c.json({ id: "2", name: c.req.valid("json").name }, 201),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const auth = new Hono().get("/google-login", (c) => c.json({ authUrl: "https://accounts.example.com" }));
|
|
97
|
+
|
|
98
|
+
const app = new Hono().route("/users", users).route("/auth", auth);
|
|
99
|
+
|
|
100
|
+
export type AppSchema = HonoAppToHyperFetch<typeof app>;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const sdk = createSdk<typeof client, AppSchema>(client);
|
|
105
|
+
|
|
106
|
+
await sdk.users.$post.setPayload({ name: "Bob" }).send();
|
|
107
|
+
// kebab-case paths become camelCase properties: GET /auth/google-login
|
|
108
|
+
await sdk.auth.googleLogin.$get.send();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### React hooks on a Hono route
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { useFetch } from "@hyper-fetch/react";
|
|
115
|
+
|
|
116
|
+
import { sdk } from "./api";
|
|
117
|
+
|
|
118
|
+
export const UserName = ({ userId }: { userId: string }) => {
|
|
119
|
+
const { data, loading } = useFetch(sdk.users.$userId.$get.setParams({ userId }));
|
|
120
|
+
|
|
121
|
+
if (loading) return <p>Loading...</p>;
|
|
122
|
+
return <p>{data?.name}</p>;
|
|
123
|
+
};
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
[Apache-2.0](https://github.com/BetterTyped/hyper-fetch/blob/main/License.md)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ClientInstance, Request } from '@hyper-fetch/core';
|
|
2
|
+
import { HonoBase } from 'hono/hono-base';
|
|
3
|
+
type Prettify<T> = {
|
|
4
|
+
[K in keyof T]: T[K];
|
|
5
|
+
} & {};
|
|
6
|
+
type UnionToIntersection<U> = (U extends any ? (arg: U) => void : never) extends (arg: infer I) => void ? I : never;
|
|
7
|
+
/**
|
|
8
|
+
* `app.route()` returns a union of schemas. Merge it into one record keyed by path so that two
|
|
9
|
+
* routers registering methods on the same path end up on the same entry.
|
|
10
|
+
*/
|
|
11
|
+
type UnionKeys<U> = U extends any ? keyof U : never;
|
|
12
|
+
type MergeUnionToRecord<U> = {
|
|
13
|
+
[K in UnionKeys<U> & string]: UnionToIntersection<U extends any ? (K extends keyof U ? U[K] : never) : never>;
|
|
14
|
+
};
|
|
15
|
+
type ExtractInput<T> = "input" extends keyof T ? T["input"] : undefined;
|
|
16
|
+
type ExtractOutput<T> = "output" extends keyof T ? T["output"] : undefined;
|
|
17
|
+
type ExtractJson<T> = "json" extends keyof T ? T["json"] : undefined;
|
|
18
|
+
type ExtractQuery<T> = "query" extends keyof T ? T["query"] : undefined;
|
|
19
|
+
/** Hono encodes methods as `$get`, `$post`, ... on every path entry of the schema. */
|
|
20
|
+
type ExtractMethodKeys<T> = Extract<keyof T, `$${string}`>;
|
|
21
|
+
/**
|
|
22
|
+
* Turns every `path -> { $method: endpoint }` entry of a Hono schema into a Hyper Fetch `Request`.
|
|
23
|
+
* The full Hono path is kept as the endpoint, so `:param` segments type `setParams()`.
|
|
24
|
+
*/
|
|
25
|
+
type ConvertToRequest<Schema extends Record<string, any>, Client extends ClientInstance> = {
|
|
26
|
+
[Path in keyof Schema]: {
|
|
27
|
+
[K in ExtractMethodKeys<Schema[Path]> as K extends `$${infer M extends string}` ? `$${Lowercase<M>}` : never]: Request<ExtractOutput<Schema[Path][K]>, ExtractJson<ExtractInput<Schema[Path][K]>>, ExtractQuery<ExtractInput<Schema[Path][K]>>, undefined, Path extends string ? Path : never, Client>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type TrimStartSlash<S extends string> = S extends `/${infer R}` ? R : S;
|
|
31
|
+
type SplitPath<S extends string> = S extends "" ? [] : S extends `${infer Head}/${infer Tail}` ? [Head, ...SplitPath<Tail>] : [S];
|
|
32
|
+
type CamelCase<S extends string> = S extends `${infer H}-${infer T}` ? `${H}${Capitalize<CamelCase<T>>}` : S;
|
|
33
|
+
/**
|
|
34
|
+
* `:userId` becomes `$userId` and `google-login` becomes `googleLogin`, matching the accessors
|
|
35
|
+
* `createSdk` resolves back to the endpoint at runtime.
|
|
36
|
+
*/
|
|
37
|
+
type NormalizeSegment<S extends string> = S extends `:${infer P}` ? `$${P}` : CamelCase<S>;
|
|
38
|
+
type BuildNestedObject<Segments extends readonly string[], Value> = Segments extends [
|
|
39
|
+
infer Head extends string,
|
|
40
|
+
...infer Rest extends string[]
|
|
41
|
+
] ? {
|
|
42
|
+
[K in NormalizeSegment<Head>]: BuildNestedObject<Rest, Value>;
|
|
43
|
+
} : Value;
|
|
44
|
+
type NestFlatRecord<R extends Record<string, any>> = Prettify<UnionToIntersection<{
|
|
45
|
+
[P in keyof R & string]: BuildNestedObject<SplitPath<TrimStartSlash<P>>, R[P]>;
|
|
46
|
+
}[keyof R & string]>>;
|
|
47
|
+
/**
|
|
48
|
+
* Converts the type of a Hono app into a Hyper Fetch SDK schema for `createSdk`.
|
|
49
|
+
*
|
|
50
|
+
* Every route becomes a `Request` whose response, JSON payload, query params and endpoint come
|
|
51
|
+
* from the Hono route definition and its validators. Path segments become nested properties,
|
|
52
|
+
* `:param` segments become `$param` properties, and kebab-case segments become camelCase.
|
|
53
|
+
*
|
|
54
|
+
* Pass the type of the app returned by your route chain, including apps mounted with
|
|
55
|
+
* `app.route()` and `basePath()`. Anything that is not a Hono app resolves to `{}`.
|
|
56
|
+
*
|
|
57
|
+
* @typeParam App - The Hono app type, usually `typeof app`.
|
|
58
|
+
* @typeParam Client - The client the requests belong to. `createSdk` injects its own client, so
|
|
59
|
+
* this is only needed when the schema is used outside of `createSdk`.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* // backend
|
|
64
|
+
* const app = new Hono().get("/users/:userId", (c) => c.json({ id: c.req.param("userId") }));
|
|
65
|
+
* export type AppSchema = HonoAppToHyperFetch<typeof app>;
|
|
66
|
+
*
|
|
67
|
+
* // frontend
|
|
68
|
+
* const sdk = createSdk<typeof client, AppSchema>(client);
|
|
69
|
+
* const { data } = await sdk.users.$userId.$get.send({ params: { userId: "1" } });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export type HonoAppToHyperFetch<App, Client extends ClientInstance = ClientInstance> = App extends HonoBase<any, infer S, any, any> ? Prettify<NestFlatRecord<ConvertToRequest<MergeUnionToRecord<S>, Client>>> : {};
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=hono.types.d.ts.map
|
|
@@ -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AC,CAAC,CAAC,GACzE,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.mjs
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyper-fetch/hono",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Turn a Hono app type into a fully typed Hyper Fetch SDK schema",
|
|
5
|
+
"author": "Maciej Pyrc <maciekpyrc@gmail.com>, Kacper Skawina <kacper.skawina@gmail.com>",
|
|
6
|
+
"homepage": "https://hyperfetch.bettertyped.com/",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"main": "dist/index.mjs",
|
|
9
|
+
"module": "dist/index.mjs",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"source": "src/index.ts",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": {
|
|
16
|
+
"import": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"default": {
|
|
19
|
+
"require": "./dist/index.mjs",
|
|
20
|
+
"import": "./dist/index.mjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"start": "pnpm build && npx run-when-changed --watch 'src/**/*.ts' --exec 'pnpm build'",
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"lint": "oxlint .",
|
|
29
|
+
"format": "oxfmt --write .",
|
|
30
|
+
"typecheck": "tsgo --noEmit --emitDeclarationOnly false && tsgo --noEmit -p __tests__/tsconfig.json",
|
|
31
|
+
"tests": "pnpm lint-staged"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org/"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/BetterTyped/hyper-fetch.git",
|
|
40
|
+
"directory": "packages/hono"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/BetterTyped/hyper-fetch/issues"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@hyper-fetch/core": "*",
|
|
47
|
+
"hono": ">=4"
|
|
48
|
+
},
|
|
49
|
+
"lint-staged": {
|
|
50
|
+
"*.{js,jsx,ts,tsx}": [
|
|
51
|
+
"vitest related --run --passWithNoTests"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"hono",
|
|
56
|
+
"sdk",
|
|
57
|
+
"rpc",
|
|
58
|
+
"type-safe",
|
|
59
|
+
"hyper fetch"
|
|
60
|
+
]
|
|
61
|
+
}
|