@xframework/hono 0.4.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.
@@ -0,0 +1,22 @@
1
+
2
+ > @xframework/hono@0.4.0 build /home/runner/work/x/x/packages/@xframework/hono
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.3.5
8
+ CLI Using tsup config: /home/runner/work/x/x/packages/@xframework/hono/tsup.config.ts
9
+ CLI Target: esnext
10
+ CLI Cleaning output folder
11
+ CJS Build start
12
+ ESM Build start
13
+ CJS dist/index.cjs 1.29 KB
14
+ CJS dist/index.cjs.map 675.00 B
15
+ CJS ⚡️ Build success in 36ms
16
+ ESM dist/index.js 289.00 B
17
+ ESM dist/index.js.map 635.00 B
18
+ ESM ⚡️ Build success in 38ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 4368ms
21
+ DTS dist/index.d.cts 335.00 B
22
+ DTS dist/index.d.ts 335.00 B
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @xframework/hono
2
+
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 98dd8e4: redesign
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [98dd8e4]
12
+ - @xframework/x@0.4.0
package/dist/index.cjs ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ HonoAdapter: () => HonoAdapter
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_adapter = require("@xframework/x/adapter");
27
+ var HonoAdapter = class extends import_adapter.SyncAdapter {
28
+ hono;
29
+ constructor({ hono }) {
30
+ super();
31
+ this.hono = hono;
32
+ }
33
+ export() {
34
+ return this.hono;
35
+ }
36
+ };
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ HonoAdapter
40
+ });
41
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Hono } from \"hono\";\nimport { SyncAdapter } from \"@xframework/x/adapter\";\n\nexport class HonoAdapter<\n UserHonoInstance extends Hono,\n> extends SyncAdapter<UserHonoInstance> {\n public hono: UserHonoInstance;\n constructor({ hono }: { hono: UserHonoInstance }) {\n super();\n this.hono = hono;\n }\n\n export() {\n return this.hono;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAA4B;AAErB,IAAM,cAAN,cAEG,2BAA8B;AAAA,EAC/B;AAAA,EACP,YAAY,EAAE,KAAK,GAA+B;AAChD,UAAM;AACN,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,SAAS;AACP,WAAO,KAAK;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { Hono } from 'hono';
2
+ import { SyncAdapter } from '@xframework/x/adapter';
3
+
4
+ declare class HonoAdapter<UserHonoInstance extends Hono> extends SyncAdapter<UserHonoInstance> {
5
+ hono: UserHonoInstance;
6
+ constructor({ hono }: {
7
+ hono: UserHonoInstance;
8
+ });
9
+ export(): UserHonoInstance;
10
+ }
11
+
12
+ export { HonoAdapter };
@@ -0,0 +1,12 @@
1
+ import { Hono } from 'hono';
2
+ import { SyncAdapter } from '@xframework/x/adapter';
3
+
4
+ declare class HonoAdapter<UserHonoInstance extends Hono> extends SyncAdapter<UserHonoInstance> {
5
+ hono: UserHonoInstance;
6
+ constructor({ hono }: {
7
+ hono: UserHonoInstance;
8
+ });
9
+ export(): UserHonoInstance;
10
+ }
11
+
12
+ export { HonoAdapter };
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ // src/index.ts
2
+ import { SyncAdapter } from "@xframework/x/adapter";
3
+ var HonoAdapter = class extends SyncAdapter {
4
+ hono;
5
+ constructor({ hono }) {
6
+ super();
7
+ this.hono = hono;
8
+ }
9
+ export() {
10
+ return this.hono;
11
+ }
12
+ };
13
+ export {
14
+ HonoAdapter
15
+ };
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Hono } from \"hono\";\nimport { SyncAdapter } from \"@xframework/x/adapter\";\n\nexport class HonoAdapter<\n UserHonoInstance extends Hono,\n> extends SyncAdapter<UserHonoInstance> {\n public hono: UserHonoInstance;\n constructor({ hono }: { hono: UserHonoInstance }) {\n super();\n this.hono = hono;\n }\n\n export() {\n return this.hono;\n }\n}\n"],"mappings":";AACA,SAAS,mBAAmB;AAErB,IAAM,cAAN,cAEG,YAA8B;AAAA,EAC/B;AAAA,EACP,YAAY,EAAE,KAAK,GAA+B;AAChD,UAAM;AACN,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,SAAS;AACP,WAAO,KAAK;AAAA,EACd;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@xframework/hono",
3
+ "version": "0.4.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "require": "./dist/index.cjs",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "dependencies": {
19
+ "@xframework/x": "0.4.0"
20
+ },
21
+ "peerDependencies": {
22
+ "hono": ">=4.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^20.11.24",
26
+ "tsup": "^8.2.4",
27
+ "typescript": "^5.5.4"
28
+ },
29
+ "scripts": {
30
+ "build": "tsup",
31
+ "dev": "tsup --watch"
32
+ }
33
+ }
@@ -0,0 +1,43 @@
1
+ import { Hono } from "hono";
2
+ import { expect, it, describe } from "vitest";
3
+ import { createX } from "@xframework/x";
4
+ import { HonoAdapter } from "../index";
5
+ import { hc } from "hono/client";
6
+
7
+ describe("HonoAdapter", () => {
8
+ it("should properly initialize and export Hono instance", () => {
9
+ const hono = new Hono();
10
+ const adapter = new HonoAdapter({ hono });
11
+
12
+ expect(adapter.hono).toBe(hono);
13
+ expect(adapter.export()).toBe(hono);
14
+ });
15
+
16
+ it("should preserve Hono types and route handlers", () => {
17
+ const hono = new Hono().get("/hello/:name", (c) => {
18
+ const name = c.req.param("name");
19
+ return c.json({ message: `Hello ${name}!` });
20
+ });
21
+
22
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
+ const x = createX()
24
+ .syncAdapter("hono", () => new HonoAdapter({ hono }))
25
+ .build();
26
+
27
+ type AppType = typeof x.hono;
28
+ const client = hc<AppType>("/");
29
+ expect(client.hello[":name"].$get).toBeDefined();
30
+ });
31
+
32
+ it("should work with middleware and complex routes", () => {
33
+ const hono = new Hono()
34
+ .get("/api/users/:id", (c) => c.json({ id: c.req.param("id") }))
35
+ .post("/api/users", (c) => c.json({ status: "created" }));
36
+
37
+ const x = createX()
38
+ .syncAdapter("hono", () => new HonoAdapter({ hono }))
39
+ .build();
40
+
41
+ expect(x.hono.routes).toHaveLength(2);
42
+ });
43
+ });
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { Hono } from "hono";
2
+ import { SyncAdapter } from "@xframework/x/adapter";
3
+
4
+ export class HonoAdapter<
5
+ UserHonoInstance extends Hono,
6
+ > extends SyncAdapter<UserHonoInstance> {
7
+ public hono: UserHonoInstance;
8
+ constructor({ hono }: { hono: UserHonoInstance }) {
9
+ super();
10
+ this.hono = hono;
11
+ }
12
+
13
+ export() {
14
+ return this.hono;
15
+ }
16
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "lib": ["ESNext", "DOM"]
6
+ },
7
+ "include": ["src", "tsup.config.ts"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { tsupConfig } from "../../../utils/tsup.config";
2
+
3
+ export default tsupConfig;