@visulima/connect 4.0.0-alpha.1 → 4.0.0-alpha.11

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +28 -18
  4. package/dist/index.cjs +6 -6
  5. package/dist/index.d.cts +107 -12
  6. package/dist/index.d.mts +107 -12
  7. package/dist/index.d.ts +107 -12
  8. package/dist/index.mjs +6 -6
  9. package/dist/packem_shared/{EdgeRouter-CdtQHTwm.mjs → EdgeRouter-BHls0yWC.mjs} +43 -33
  10. package/dist/packem_shared/{EdgeRouter-B-e2l9un.cjs → EdgeRouter-DTvPX_JS.cjs} +43 -33
  11. package/dist/packem_shared/Router-CT_g_29S.mjs +168 -0
  12. package/dist/packem_shared/Router-DMp6zIkp.cjs +172 -0
  13. package/dist/packem_shared/{createRouter-C8hDVJcV.cjs → createRouter-B4-TLOnM.cjs} +43 -32
  14. package/dist/packem_shared/{createRouter-_G1XhaP4.mjs → createRouter-DGGDIRda.mjs} +43 -32
  15. package/dist/packem_shared/expressWrapper-CeTFmeNH.mjs +14 -0
  16. package/dist/packem_shared/expressWrapper-oEj2tv9s.cjs +16 -0
  17. package/dist/packem_shared/{sendJson-DwLYLDbt.mjs → sendJson-Cd6CsJC_.mjs} +1 -1
  18. package/dist/packem_shared/{sendJson-pJY2tT2n.cjs → sendJson-DjC80Qht.cjs} +1 -1
  19. package/dist/packem_shared/{withZod-HYgoC7AX.mjs → withZod-DMHxmHJB.mjs} +3 -6
  20. package/dist/packem_shared/withZod-hpoT0ByV.cjs +34 -0
  21. package/package.json +10 -9
  22. package/dist/adapter/express.d.cts +0 -7
  23. package/dist/adapter/express.d.mts +0 -7
  24. package/dist/adapter/express.d.ts +0 -7
  25. package/dist/adapter/with-zod.d.cts +0 -8
  26. package/dist/adapter/with-zod.d.mts +0 -8
  27. package/dist/adapter/with-zod.d.ts +0 -8
  28. package/dist/edge.d.cts +0 -30
  29. package/dist/edge.d.mts +0 -30
  30. package/dist/edge.d.ts +0 -30
  31. package/dist/node.d.cts +0 -33
  32. package/dist/node.d.mts +0 -33
  33. package/dist/node.d.ts +0 -33
  34. package/dist/packem_shared/Router-ChnTdYfl.mjs +0 -135
  35. package/dist/packem_shared/Router-Eg_OPxIL.cjs +0 -139
  36. package/dist/packem_shared/expressWrapper-CTExfWvM.cjs +0 -10
  37. package/dist/packem_shared/expressWrapper-spfs58is.mjs +0 -8
  38. package/dist/packem_shared/withZod-ULTsdyM5.cjs +0 -24
  39. package/dist/router.d.cts +0 -21
  40. package/dist/router.d.mts +0 -21
  41. package/dist/router.d.ts +0 -21
  42. package/dist/utils/send-json.d.cts +0 -9
  43. package/dist/utils/send-json.d.mts +0 -9
  44. package/dist/utils/send-json.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -1,3 +1,111 @@
1
+ ## @visulima/connect [4.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.10...@visulima/connect@4.0.0-alpha.11) (2026-04-30)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **connect:** upgrade packem to 2.0.0-alpha.76 ([7e3a33b](https://github.com/visulima/visulima/commit/7e3a33b6668284452fd51af3c99d2af3be2e61d5))
6
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
7
+
8
+ ## @visulima/connect [4.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.9...@visulima/connect@4.0.0-alpha.10) (2026-04-22)
9
+
10
+ ### Bug Fixes
11
+
12
+ * Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
13
+
14
+ ### Miscellaneous Chores
15
+
16
+ * bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
17
+ * fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
18
+
19
+ ## @visulima/connect [4.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.8...@visulima/connect@4.0.0-alpha.9) (2026-04-15)
20
+
21
+ ### Bug Fixes
22
+
23
+ * **api:** resolve eslint and type-safety issues across api packages ([3601491](https://github.com/visulima/visulima/commit/3601491261de56b5cfad87c97daafd458e4ee3b6))
24
+ * **connect:** cast onNoMatch/onError defaults through unknown for stricter handler types ([d1bfb2e](https://github.com/visulima/visulima/commit/d1bfb2eeb0b0760b9e4a4536bd6a58301f7628db))
25
+
26
+ ## @visulima/connect [4.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.7...@visulima/connect@4.0.0-alpha.8) (2026-04-08)
27
+
28
+ ### Bug Fixes
29
+
30
+ * **connect:** properly fix eslint errors in code ([5266ef1](https://github.com/visulima/visulima/commit/5266ef1ee416732409b8bff352247fc972929634))
31
+ * **connect:** remove remaining eslint suppressions with proper code fixes ([bc69936](https://github.com/visulima/visulima/commit/bc69936bd0508def799d95a1772a5792fb57949c))
32
+ * **connect:** resolve eslint errors ([49abc96](https://github.com/visulima/visulima/commit/49abc96b7cccbedb47507adda539cdf715dfc7a9))
33
+
34
+ ### Miscellaneous Chores
35
+
36
+ * **api:** remove empty dependency objects from package.json ([f6bfc85](https://github.com/visulima/visulima/commit/f6bfc85c48c973ff8ea0a7db5951794ae0ea3efb))
37
+ * **connect:** add tsconfig.eslint.json for type-aware linting ([d8e6ae1](https://github.com/visulima/visulima/commit/d8e6ae1cfe5ce82d228054feb35b7fa4a4503211))
38
+ * **connect:** apply prettier formatting ([8ecf930](https://github.com/visulima/visulima/commit/8ecf93071cb0087a8c49520cc594a753dba5e39d))
39
+ * **connect:** migrate .prettierrc.cjs to prettier.config.js ([949d441](https://github.com/visulima/visulima/commit/949d44166d9ce6f66044d87eb0bdd0a8b85c03ed))
40
+
41
+ ## @visulima/connect [4.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.6...@visulima/connect@4.0.0-alpha.7) (2026-03-26)
42
+
43
+ ### Features
44
+
45
+ * **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
46
+
47
+ ### Miscellaneous Chores
48
+
49
+ * update homepage URLs to visulima.com/packages/ format ([be42968](https://github.com/visulima/visulima/commit/be42968129df85fb074224435e33135ff44cab91))
50
+
51
+ ## @visulima/connect [4.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.5...@visulima/connect@4.0.0-alpha.6) (2026-03-26)
52
+
53
+ ### Bug Fixes
54
+
55
+ * **connect:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([7edea03](https://github.com/visulima/visulima/commit/7edea03b564d19f7393f01138b74ac1239562dd9))
56
+ * **web:** enhance copy-package-docs with asset copying, link rewriting, and broken link removal ([05e481f](https://github.com/visulima/visulima/commit/05e481f8280ba889d241a645f29c573554822f3d))
57
+ * **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
58
+
59
+ ### Miscellaneous Chores
60
+
61
+ * **connect:** migrate deps to pnpm catalogs ([30a087b](https://github.com/visulima/visulima/commit/30a087b2f08bfe17b733cf0bdd969f1638189fca))
62
+ * **connect:** update dependencies ([a9ec468](https://github.com/visulima/visulima/commit/a9ec4689533c84c075519c2622f48854ceb05a0d))
63
+
64
+ ### Code Refactoring
65
+
66
+ * **docs:** migrate Nextra components to fumadocs-ui, remove Nextra stripping ([484878f](https://github.com/visulima/visulima/commit/484878f01879363ef5e9a0282904dc4627d6060c))
67
+
68
+ ## @visulima/connect [4.0.0-alpha.5](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.4...@visulima/connect@4.0.0-alpha.5) (2026-03-06)
69
+
70
+ ### Bug Fixes
71
+
72
+ * **connect:** update packem to 2.0.0-alpha.54 ([840996e](https://github.com/visulima/visulima/commit/840996e2d727531c4bf9b27b5f10d709740b0280))
73
+
74
+ ### Miscellaneous Chores
75
+
76
+ * **api:** update dependencies ([f3b6f7c](https://github.com/visulima/visulima/commit/f3b6f7c956e8ae2c0da67773b3790f159c07de29))
77
+ * **connect:** update dependencies ([02fa39c](https://github.com/visulima/visulima/commit/02fa39cba26804aa95eef0a69e08bc7d365ff282))
78
+ * **connect:** update dependencies ([bd628b3](https://github.com/visulima/visulima/commit/bd628b38c9b2bc0f6fed5af5f19d4dbace9f7c21))
79
+ * update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
80
+ * year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
81
+
82
+ ## @visulima/connect [4.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.3...@visulima/connect@4.0.0-alpha.4) (2025-12-27)
83
+
84
+ ### Bug Fixes
85
+
86
+ * **connect:** update package files ([f5594b5](https://github.com/visulima/visulima/commit/f5594b54b2e9dc440fa3ea09efa361ca2030b125))
87
+
88
+ ### Miscellaneous Chores
89
+
90
+ * fixed project.json names and schema path ([964722f](https://github.com/visulima/visulima/commit/964722f691db205c7edb9aa6db29e849a647500b))
91
+
92
+ ## @visulima/connect [4.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.2...@visulima/connect@4.0.0-alpha.3) (2025-12-11)
93
+
94
+ ### Bug Fixes
95
+
96
+ * update package OG images across multiple packages ([f08e4dd](https://github.com/visulima/visulima/commit/f08e4dd2b105ccb29c8412020a9c2be36d6c1e9e))
97
+
98
+ ## @visulima/connect [4.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/connect@4.0.0-alpha.1...@visulima/connect@4.0.0-alpha.2) (2025-12-06)
99
+
100
+ ### Bug Fixes
101
+
102
+ * add new package image, fixed readme rendering on npm, fixed building of packages ([b790ba2](https://github.com/visulima/visulima/commit/b790ba253ea07fef83528fd822a678facf021b5f))
103
+ * update package.json description and keywords ([#578](https://github.com/visulima/visulima/issues/578)) ([154709c](https://github.com/visulima/visulima/commit/154709c05e71d1ffd3e360b27e12febd817912f0))
104
+
105
+ ### Miscellaneous Chores
106
+
107
+ * update @anolilab/semantic-release-pnpm and @anolilab/semantic-release-preset to versions 3.2.2 and 12.1.2 across multiple package.json files for improved compatibility ([3921626](https://github.com/visulima/visulima/commit/3921626141fe5da398749bf0ba675f1596f18afb))
108
+
1
109
  ## @visulima/connect [4.0.0-alpha.1](https://github.com/visulima/visulima/compare/@visulima/connect@3.0.27...@visulima/connect@4.0.0-alpha.1) (2025-12-04)
2
110
 
3
111
  ### ⚠ BREAKING CHANGES
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 visulima
3
+ Copyright (c) 2026 visulima
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,23 +1,24 @@
1
- <div align="center">
2
- <h3>Visulima connect</h3>
3
- <p>
4
- The promise-based method routing and middleware layer with zod validation for <a href="https://nextjs.org/" title="Next.js">Next.js</a> (API Routes, Edge API Routes, App Router, getServerSideProps, Middleware) and many other frameworks is built on top of
1
+ <!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
5
2
 
6
- [http-errors](https://github.com/jshttp/http-errors),
7
- [regexparam](https://github.com/lukeed/regexparam)
3
+ <a href="https://www.anolilab.com/open-source" align="center">
8
4
 
9
- and based on
5
+ <img src="__assets__/package-og.svg" alt="connect" />
10
6
 
11
- [next-connect](https://github.com/hoangvvo/next-connect)
7
+ </a>
12
8
 
13
- </p>
14
- </div>
9
+ <h3 align="center">The minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2 with support for zod validation.</h3>
10
+
11
+ <!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
15
12
 
16
13
  <br />
17
14
 
18
15
  <div align="center">
19
16
 
20
- [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
17
+ [![typescript-image][typescript-badge]][typescript-url]
18
+ [![mit licence][license-badge]][license]
19
+ [![npm downloads][npm-downloads-badge]][npm-downloads]
20
+ [![Chat][chat-badge]][chat]
21
+ [![PRs Welcome][prs-welcome-badge]][prs-welcome]
21
22
 
22
23
  </div>
23
24
 
@@ -616,14 +617,23 @@ If you would like to help take a look at the [list of issues](https://github.com
616
617
  - [Daniel Bannert](https://github.com/prisis)
617
618
  - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
618
619
 
620
+ ## Made with ❤️ at Anolilab
621
+
622
+ This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
623
+
619
624
  ## License
620
625
 
621
- The visulima connect is open-sourced software licensed under the [MIT][license-url]
626
+ The visulima connect is open-sourced software licensed under the [MIT][license]
622
627
 
623
- [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
628
+ <!-- badges -->
624
629
 
625
- [typescript-url]: https://www.typescriptlang.org/ "TypeScript" "typescript"
626
- [license-image]: https://img.shields.io/npm/l/@visulima/connect?color=blueviolet&style=for-the-badge
627
- [license-url]: LICENSE.md "license"
628
- [npm-image]: https://img.shields.io/npm/v/@visulima/connect/latest.svg?style=for-the-badge&logo=npm
629
- [npm-url]: https://www.npmjs.com/package/@visulima/connect/v/latest "npm"
630
+ [license-badge]: https://img.shields.io/npm/l/@visulima/connect?style=for-the-badge
631
+ [license]: https://github.com/visulima/visulima/blob/main/LICENSE
632
+ [npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/connect?style=for-the-badge
633
+ [npm-downloads]: https://www.npmjs.com/package/@visulima/connect
634
+ [prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
635
+ [prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
636
+ [chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
637
+ [chat]: https://discord.gg/TtFJY8xkFK
638
+ [typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
639
+ [typescript-url]: https://www.typescriptlang.org/
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
4
 
5
- const expressWrapper = require('./packem_shared/expressWrapper-CTExfWvM.cjs');
6
- const withZod = require('./packem_shared/withZod-ULTsdyM5.cjs');
7
- const EdgeRouter = require('./packem_shared/EdgeRouter-B-e2l9un.cjs');
8
- const createRouter = require('./packem_shared/createRouter-C8hDVJcV.cjs');
9
- const Router = require('./packem_shared/Router-Eg_OPxIL.cjs');
10
- const sendJson = require('./packem_shared/sendJson-pJY2tT2n.cjs');
5
+ const expressWrapper = require('./packem_shared/expressWrapper-oEj2tv9s.cjs');
6
+ const withZod = require('./packem_shared/withZod-hpoT0ByV.cjs');
7
+ const EdgeRouter = require('./packem_shared/EdgeRouter-DTvPX_JS.cjs');
8
+ const createRouter = require('./packem_shared/createRouter-B4-TLOnM.cjs');
9
+ const Router = require('./packem_shared/Router-DMp6zIkp.cjs');
10
+ const sendJson = require('./packem_shared/sendJson-DjC80Qht.cjs');
11
11
 
12
12
 
13
13
 
package/dist/index.d.cts CHANGED
@@ -1,12 +1,107 @@
1
- export type { ExpressRequestHandler } from "./adapter/express.d.cts";
2
- export { default as expressWrapper } from "./adapter/express.d.cts";
3
- export { default as withZod } from "./adapter/with-zod.d.cts";
4
- export type { RequestHandler as EdgeRequestHandler } from "./edge.d.cts";
5
- export { createEdgeRouter, EdgeRouter } from "./edge.d.cts";
6
- export type { RequestHandler as NodeRequestHandler } from "./node.d.cts";
7
- export { createRouter } from "./node.d.cts";
8
- export { createRouter as createNodeRouter, NodeRouter } from "./node.d.cts";
9
- export type { Route } from "./router.d.cts";
10
- export { Router } from "./router.d.cts";
11
- export type { FindResult, FunctionLike, HandlerOptions, HttpMethod, Nextable, NextHandler, RouteShortcutMethod, ValueOrPromise } from "./types.d.d.cts";
12
- export { default as sendJson } from "./utils/send-json.d.cts";
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import * as z from 'zod';
3
+ type HttpMethod = "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE";
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- base function type requires `any` for variance compatibility
5
+ type FunctionLike = (...arguments_: any[]) => any;
6
+ type RouteMatch = RegExp | string;
7
+ type ValueOrPromise<T> = Promise<T> | T;
8
+ type NextHandler = () => ValueOrPromise<unknown>;
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- must return `any` to match arbitrary handler signatures
10
+ type Nextable<H extends FunctionLike> = (...arguments_: [...Parameters<H>, NextHandler]) => ValueOrPromise<any>;
11
+ interface FindResult<H extends FunctionLike> {
12
+ fns: Nextable<H>[];
13
+ middleOnly: boolean;
14
+ params: Record<string, string>;
15
+ }
16
+ type RoutesExtendedRequestHandler<Request extends object, Context, RResponse, Routes> = (request: Request, response: Context, routes: Routes) => ValueOrPromise<RResponse | undefined>;
17
+ interface HandlerOptions<Handler extends FunctionLike> {
18
+ onError?: (error: unknown, ...arguments_: Parameters<Handler>) => ReturnType<Handler>;
19
+ onNoMatch?: Handler;
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject requires `any` for generic parameter compatibility
22
+ type RouteShortcutMethod<This, Schema extends z.ZodObject<any>, H extends FunctionLike> = (route: Nextable<H> | RouteMatch, zodSchemaOrRouteOrFns?: Nextable<H> | RouteMatch | Schema | string, ...fns: Nextable<H>[]) => This;
23
+ type Route<H> = {
24
+ fns: (H | Router<H extends FunctionLike ? H : never>)[];
25
+ isMiddleware: boolean;
26
+ method: HttpMethod | "";
27
+ } & ({
28
+ keys: string[] | false;
29
+ pattern: RegExp;
30
+ } | {
31
+ matchAll: true;
32
+ });
33
+ declare class Router<H extends FunctionLike> {
34
+ base: string;
35
+ routes: Route<Nextable<H>>[];
36
+ static exec<FL extends FunctionLike>(fns: (Nextable<FL> | undefined)[], ...arguments_: Parameters<FL>): Promise<unknown>;
37
+ private static extractRegExpParams;
38
+ private static extractKeyedParams;
39
+ private static isMethodMatch;
40
+ private static matchRoute;
41
+ private static resolveRouteFns;
42
+ constructor(base?: string, routes?: Route<Nextable<H>>[]);
43
+ add(method: HttpMethod | "", route: Nextable<H> | RouteMatch, ...fns: Nextable<H>[]): this;
44
+ clone(base?: string): Router<H>;
45
+ find(method: HttpMethod, pathname: string): FindResult<H>;
46
+ use(base: Nextable<H> | RouteMatch | Router<H>, ...fns: (Nextable<H> | Router<H>)[]): this;
47
+ }
48
+ type RequestHandler$1<Request extends IncomingMessage, Response extends ServerResponse> = (request: Request, response: Response) => ValueOrPromise<void>;
49
+ declare class NodeRouter<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
50
+ private static prepareRequest;
51
+ all: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
52
+ connect: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
53
+ delete: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
54
+ get: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
55
+ head: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
56
+ options: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
57
+ patch: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
58
+ post: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
59
+ put: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
60
+ trace: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
61
+ private readonly onError;
62
+ private readonly onNoMatch;
63
+ private router;
64
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>);
65
+ clone(): NodeRouter<Request, Response, Schema>;
66
+ handler(): (request: Request, response: Response) => Promise<void>;
67
+ run(request: Request, response: Response): Promise<unknown>;
68
+ use(base: Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema> | RouteMatch, ...fns: (Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema>)[]): this;
69
+ private add;
70
+ }
71
+ declare const createRouter: <Request extends IncomingMessage, Response extends ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>>(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>) => NodeRouter<Request, Response, Schema>;
72
+ type NextFunction = (error?: Error) => void;
73
+ declare const expressWrapper: <Request extends IncomingMessage, Response extends ServerResponse>(function_: ExpressRequestHandler<Request, Response>) => Nextable<RequestHandler$1<Request, Response>>;
74
+ type ExpressRequestHandler<Request, Response> = (request: Request, response: Response, next: NextFunction) => void;
75
+ declare const withZod: (schema: z.ZodObject<any>, handler: Nextable<FunctionLike>) => (request: unknown, response: unknown, next: NextHandler) => Promise<unknown>;
76
+ type RequestHandler<R extends Request, Context> = (request: R, context_: Context) => ValueOrPromise<Response | undefined>;
77
+ declare class EdgeRouter<R extends Request = Request, Context = unknown, RResponse extends Response = Response, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
78
+ private static prepareRequest;
79
+ all: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
80
+ connect: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
81
+ delete: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
82
+ get: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
83
+ head: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
84
+ options: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
85
+ patch: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
86
+ post: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
87
+ put: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
88
+ trace: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
89
+ private readonly onError;
90
+ private readonly onNoMatch;
91
+ private router;
92
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, RResponse, Route<Nextable<FunctionLike>>[]>>);
93
+ clone(): EdgeRouter<R, Context, RResponse, Schema>;
94
+ handler(): (request: R, context_: Context) => Promise<RResponse | undefined>;
95
+ run(request: R, context_: Context): Promise<unknown>;
96
+ use(base: EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>> | RouteMatch, ...fns: (EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>>)[]): this;
97
+ private add;
98
+ }
99
+ declare const createEdgeRouter: <R extends Request, Context>(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, Response, Route<Nextable<FunctionLike>>[]>>) => EdgeRouter<R, Context>;
100
+ /**
101
+ * Send `JSON` object.
102
+ * @param response Response object.
103
+ * @param statusCode The HTTP status code.
104
+ * @param jsonBody The body of data.
105
+ */
106
+ declare const sendJson: (response: ServerResponse, statusCode: number, jsonBody: unknown) => void;
107
+ export { type RequestHandler as EdgeRequestHandler, EdgeRouter, type ExpressRequestHandler, type FindResult, type FunctionLike, type HandlerOptions, type HttpMethod, type NextHandler, type Nextable, type RequestHandler$1 as NodeRequestHandler, NodeRouter, type Route, type RouteShortcutMethod, Router, type ValueOrPromise, createEdgeRouter, createRouter as createNodeRouter, createRouter, expressWrapper, sendJson, withZod };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,107 @@
1
- export type { ExpressRequestHandler } from "./adapter/express.d.mts";
2
- export { default as expressWrapper } from "./adapter/express.d.mts";
3
- export { default as withZod } from "./adapter/with-zod.d.mts";
4
- export type { RequestHandler as EdgeRequestHandler } from "./edge.d.mts";
5
- export { createEdgeRouter, EdgeRouter } from "./edge.d.mts";
6
- export type { RequestHandler as NodeRequestHandler } from "./node.d.mts";
7
- export { createRouter } from "./node.d.mts";
8
- export { createRouter as createNodeRouter, NodeRouter } from "./node.d.mts";
9
- export type { Route } from "./router.d.mts";
10
- export { Router } from "./router.d.mts";
11
- export type { FindResult, FunctionLike, HandlerOptions, HttpMethod, Nextable, NextHandler, RouteShortcutMethod, ValueOrPromise } from "./types.d.d.mts";
12
- export { default as sendJson } from "./utils/send-json.d.mts";
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import * as z from 'zod';
3
+ type HttpMethod = "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE";
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- base function type requires `any` for variance compatibility
5
+ type FunctionLike = (...arguments_: any[]) => any;
6
+ type RouteMatch = RegExp | string;
7
+ type ValueOrPromise<T> = Promise<T> | T;
8
+ type NextHandler = () => ValueOrPromise<unknown>;
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- must return `any` to match arbitrary handler signatures
10
+ type Nextable<H extends FunctionLike> = (...arguments_: [...Parameters<H>, NextHandler]) => ValueOrPromise<any>;
11
+ interface FindResult<H extends FunctionLike> {
12
+ fns: Nextable<H>[];
13
+ middleOnly: boolean;
14
+ params: Record<string, string>;
15
+ }
16
+ type RoutesExtendedRequestHandler<Request extends object, Context, RResponse, Routes> = (request: Request, response: Context, routes: Routes) => ValueOrPromise<RResponse | undefined>;
17
+ interface HandlerOptions<Handler extends FunctionLike> {
18
+ onError?: (error: unknown, ...arguments_: Parameters<Handler>) => ReturnType<Handler>;
19
+ onNoMatch?: Handler;
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject requires `any` for generic parameter compatibility
22
+ type RouteShortcutMethod<This, Schema extends z.ZodObject<any>, H extends FunctionLike> = (route: Nextable<H> | RouteMatch, zodSchemaOrRouteOrFns?: Nextable<H> | RouteMatch | Schema | string, ...fns: Nextable<H>[]) => This;
23
+ type Route<H> = {
24
+ fns: (H | Router<H extends FunctionLike ? H : never>)[];
25
+ isMiddleware: boolean;
26
+ method: HttpMethod | "";
27
+ } & ({
28
+ keys: string[] | false;
29
+ pattern: RegExp;
30
+ } | {
31
+ matchAll: true;
32
+ });
33
+ declare class Router<H extends FunctionLike> {
34
+ base: string;
35
+ routes: Route<Nextable<H>>[];
36
+ static exec<FL extends FunctionLike>(fns: (Nextable<FL> | undefined)[], ...arguments_: Parameters<FL>): Promise<unknown>;
37
+ private static extractRegExpParams;
38
+ private static extractKeyedParams;
39
+ private static isMethodMatch;
40
+ private static matchRoute;
41
+ private static resolveRouteFns;
42
+ constructor(base?: string, routes?: Route<Nextable<H>>[]);
43
+ add(method: HttpMethod | "", route: Nextable<H> | RouteMatch, ...fns: Nextable<H>[]): this;
44
+ clone(base?: string): Router<H>;
45
+ find(method: HttpMethod, pathname: string): FindResult<H>;
46
+ use(base: Nextable<H> | RouteMatch | Router<H>, ...fns: (Nextable<H> | Router<H>)[]): this;
47
+ }
48
+ type RequestHandler$1<Request extends IncomingMessage, Response extends ServerResponse> = (request: Request, response: Response) => ValueOrPromise<void>;
49
+ declare class NodeRouter<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
50
+ private static prepareRequest;
51
+ all: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
52
+ connect: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
53
+ delete: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
54
+ get: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
55
+ head: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
56
+ options: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
57
+ patch: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
58
+ post: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
59
+ put: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
60
+ trace: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
61
+ private readonly onError;
62
+ private readonly onNoMatch;
63
+ private router;
64
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>);
65
+ clone(): NodeRouter<Request, Response, Schema>;
66
+ handler(): (request: Request, response: Response) => Promise<void>;
67
+ run(request: Request, response: Response): Promise<unknown>;
68
+ use(base: Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema> | RouteMatch, ...fns: (Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema>)[]): this;
69
+ private add;
70
+ }
71
+ declare const createRouter: <Request extends IncomingMessage, Response extends ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>>(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>) => NodeRouter<Request, Response, Schema>;
72
+ type NextFunction = (error?: Error) => void;
73
+ declare const expressWrapper: <Request extends IncomingMessage, Response extends ServerResponse>(function_: ExpressRequestHandler<Request, Response>) => Nextable<RequestHandler$1<Request, Response>>;
74
+ type ExpressRequestHandler<Request, Response> = (request: Request, response: Response, next: NextFunction) => void;
75
+ declare const withZod: (schema: z.ZodObject<any>, handler: Nextable<FunctionLike>) => (request: unknown, response: unknown, next: NextHandler) => Promise<unknown>;
76
+ type RequestHandler<R extends Request, Context> = (request: R, context_: Context) => ValueOrPromise<Response | undefined>;
77
+ declare class EdgeRouter<R extends Request = Request, Context = unknown, RResponse extends Response = Response, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
78
+ private static prepareRequest;
79
+ all: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
80
+ connect: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
81
+ delete: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
82
+ get: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
83
+ head: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
84
+ options: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
85
+ patch: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
86
+ post: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
87
+ put: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
88
+ trace: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
89
+ private readonly onError;
90
+ private readonly onNoMatch;
91
+ private router;
92
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, RResponse, Route<Nextable<FunctionLike>>[]>>);
93
+ clone(): EdgeRouter<R, Context, RResponse, Schema>;
94
+ handler(): (request: R, context_: Context) => Promise<RResponse | undefined>;
95
+ run(request: R, context_: Context): Promise<unknown>;
96
+ use(base: EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>> | RouteMatch, ...fns: (EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>>)[]): this;
97
+ private add;
98
+ }
99
+ declare const createEdgeRouter: <R extends Request, Context>(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, Response, Route<Nextable<FunctionLike>>[]>>) => EdgeRouter<R, Context>;
100
+ /**
101
+ * Send `JSON` object.
102
+ * @param response Response object.
103
+ * @param statusCode The HTTP status code.
104
+ * @param jsonBody The body of data.
105
+ */
106
+ declare const sendJson: (response: ServerResponse, statusCode: number, jsonBody: unknown) => void;
107
+ export { type RequestHandler as EdgeRequestHandler, EdgeRouter, type ExpressRequestHandler, type FindResult, type FunctionLike, type HandlerOptions, type HttpMethod, type NextHandler, type Nextable, type RequestHandler$1 as NodeRequestHandler, NodeRouter, type Route, type RouteShortcutMethod, Router, type ValueOrPromise, createEdgeRouter, createRouter as createNodeRouter, createRouter, expressWrapper, sendJson, withZod };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,107 @@
1
- export type { ExpressRequestHandler } from "./adapter/express.d.ts";
2
- export { default as expressWrapper } from "./adapter/express.d.ts";
3
- export { default as withZod } from "./adapter/with-zod.d.ts";
4
- export type { RequestHandler as EdgeRequestHandler } from "./edge.d.ts";
5
- export { createEdgeRouter, EdgeRouter } from "./edge.d.ts";
6
- export type { RequestHandler as NodeRequestHandler } from "./node.d.ts";
7
- export { createRouter } from "./node.d.ts";
8
- export { createRouter as createNodeRouter, NodeRouter } from "./node.d.ts";
9
- export type { Route } from "./router.d.ts";
10
- export { Router } from "./router.d.ts";
11
- export type { FindResult, FunctionLike, HandlerOptions, HttpMethod, Nextable, NextHandler, RouteShortcutMethod, ValueOrPromise } from "./types.d.d.ts";
12
- export { default as sendJson } from "./utils/send-json.d.ts";
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import * as z from 'zod';
3
+ type HttpMethod = "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE";
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- base function type requires `any` for variance compatibility
5
+ type FunctionLike = (...arguments_: any[]) => any;
6
+ type RouteMatch = RegExp | string;
7
+ type ValueOrPromise<T> = Promise<T> | T;
8
+ type NextHandler = () => ValueOrPromise<unknown>;
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- must return `any` to match arbitrary handler signatures
10
+ type Nextable<H extends FunctionLike> = (...arguments_: [...Parameters<H>, NextHandler]) => ValueOrPromise<any>;
11
+ interface FindResult<H extends FunctionLike> {
12
+ fns: Nextable<H>[];
13
+ middleOnly: boolean;
14
+ params: Record<string, string>;
15
+ }
16
+ type RoutesExtendedRequestHandler<Request extends object, Context, RResponse, Routes> = (request: Request, response: Context, routes: Routes) => ValueOrPromise<RResponse | undefined>;
17
+ interface HandlerOptions<Handler extends FunctionLike> {
18
+ onError?: (error: unknown, ...arguments_: Parameters<Handler>) => ReturnType<Handler>;
19
+ onNoMatch?: Handler;
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject requires `any` for generic parameter compatibility
22
+ type RouteShortcutMethod<This, Schema extends z.ZodObject<any>, H extends FunctionLike> = (route: Nextable<H> | RouteMatch, zodSchemaOrRouteOrFns?: Nextable<H> | RouteMatch | Schema | string, ...fns: Nextable<H>[]) => This;
23
+ type Route<H> = {
24
+ fns: (H | Router<H extends FunctionLike ? H : never>)[];
25
+ isMiddleware: boolean;
26
+ method: HttpMethod | "";
27
+ } & ({
28
+ keys: string[] | false;
29
+ pattern: RegExp;
30
+ } | {
31
+ matchAll: true;
32
+ });
33
+ declare class Router<H extends FunctionLike> {
34
+ base: string;
35
+ routes: Route<Nextable<H>>[];
36
+ static exec<FL extends FunctionLike>(fns: (Nextable<FL> | undefined)[], ...arguments_: Parameters<FL>): Promise<unknown>;
37
+ private static extractRegExpParams;
38
+ private static extractKeyedParams;
39
+ private static isMethodMatch;
40
+ private static matchRoute;
41
+ private static resolveRouteFns;
42
+ constructor(base?: string, routes?: Route<Nextable<H>>[]);
43
+ add(method: HttpMethod | "", route: Nextable<H> | RouteMatch, ...fns: Nextable<H>[]): this;
44
+ clone(base?: string): Router<H>;
45
+ find(method: HttpMethod, pathname: string): FindResult<H>;
46
+ use(base: Nextable<H> | RouteMatch | Router<H>, ...fns: (Nextable<H> | Router<H>)[]): this;
47
+ }
48
+ type RequestHandler$1<Request extends IncomingMessage, Response extends ServerResponse> = (request: Request, response: Response) => ValueOrPromise<void>;
49
+ declare class NodeRouter<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
50
+ private static prepareRequest;
51
+ all: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
52
+ connect: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
53
+ delete: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
54
+ get: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
55
+ head: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
56
+ options: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
57
+ patch: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
58
+ post: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
59
+ put: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
60
+ trace: RouteShortcutMethod<this, Schema, RequestHandler$1<Request, Response>>;
61
+ private readonly onError;
62
+ private readonly onNoMatch;
63
+ private router;
64
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>);
65
+ clone(): NodeRouter<Request, Response, Schema>;
66
+ handler(): (request: Request, response: Response) => Promise<void>;
67
+ run(request: Request, response: Response): Promise<unknown>;
68
+ use(base: Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema> | RouteMatch, ...fns: (Nextable<RequestHandler$1<Request, Response>> | NodeRouter<Request, Response, Schema>)[]): this;
69
+ private add;
70
+ }
71
+ declare const createRouter: <Request extends IncomingMessage, Response extends ServerResponse, Schema extends z.ZodObject<any> = z.ZodObject<any>>(options?: HandlerOptions<RoutesExtendedRequestHandler<Request, Response, Response, Route<Nextable<FunctionLike>>[]>>) => NodeRouter<Request, Response, Schema>;
72
+ type NextFunction = (error?: Error) => void;
73
+ declare const expressWrapper: <Request extends IncomingMessage, Response extends ServerResponse>(function_: ExpressRequestHandler<Request, Response>) => Nextable<RequestHandler$1<Request, Response>>;
74
+ type ExpressRequestHandler<Request, Response> = (request: Request, response: Response, next: NextFunction) => void;
75
+ declare const withZod: (schema: z.ZodObject<any>, handler: Nextable<FunctionLike>) => (request: unknown, response: unknown, next: NextHandler) => Promise<unknown>;
76
+ type RequestHandler<R extends Request, Context> = (request: R, context_: Context) => ValueOrPromise<Response | undefined>;
77
+ declare class EdgeRouter<R extends Request = Request, Context = unknown, RResponse extends Response = Response, Schema extends z.ZodObject<any> = z.ZodObject<any>> {
78
+ private static prepareRequest;
79
+ all: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
80
+ connect: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
81
+ delete: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
82
+ get: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
83
+ head: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
84
+ options: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
85
+ patch: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
86
+ post: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
87
+ put: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
88
+ trace: RouteShortcutMethod<this, Schema, RequestHandler<R, Context>>;
89
+ private readonly onError;
90
+ private readonly onNoMatch;
91
+ private router;
92
+ constructor(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, RResponse, Route<Nextable<FunctionLike>>[]>>);
93
+ clone(): EdgeRouter<R, Context, RResponse, Schema>;
94
+ handler(): (request: R, context_: Context) => Promise<RResponse | undefined>;
95
+ run(request: R, context_: Context): Promise<unknown>;
96
+ use(base: EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>> | RouteMatch, ...fns: (EdgeRouter<R, Context> | Nextable<RequestHandler<R, Context>>)[]): this;
97
+ private add;
98
+ }
99
+ declare const createEdgeRouter: <R extends Request, Context>(options?: HandlerOptions<RoutesExtendedRequestHandler<R, Context, Response, Route<Nextable<FunctionLike>>[]>>) => EdgeRouter<R, Context>;
100
+ /**
101
+ * Send `JSON` object.
102
+ * @param response Response object.
103
+ * @param statusCode The HTTP status code.
104
+ * @param jsonBody The body of data.
105
+ */
106
+ declare const sendJson: (response: ServerResponse, statusCode: number, jsonBody: unknown) => void;
107
+ export { type RequestHandler as EdgeRequestHandler, EdgeRouter, type ExpressRequestHandler, type FindResult, type FunctionLike, type HandlerOptions, type HttpMethod, type NextHandler, type Nextable, type RequestHandler$1 as NodeRequestHandler, NodeRouter, type Route, type RouteShortcutMethod, Router, type ValueOrPromise, createEdgeRouter, createRouter as createNodeRouter, createRouter, expressWrapper, sendJson, withZod };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { default as expressWrapper } from './packem_shared/expressWrapper-spfs58is.mjs';
2
- export { default as withZod } from './packem_shared/withZod-HYgoC7AX.mjs';
3
- export { EdgeRouter, createEdgeRouter } from './packem_shared/EdgeRouter-CdtQHTwm.mjs';
4
- export { NodeRouter, createRouter as createNodeRouter, createRouter } from './packem_shared/createRouter-_G1XhaP4.mjs';
5
- export { Router } from './packem_shared/Router-ChnTdYfl.mjs';
6
- export { default as sendJson } from './packem_shared/sendJson-DwLYLDbt.mjs';
1
+ export { default as expressWrapper } from './packem_shared/expressWrapper-CeTFmeNH.mjs';
2
+ export { default as withZod } from './packem_shared/withZod-DMHxmHJB.mjs';
3
+ export { EdgeRouter, createEdgeRouter } from './packem_shared/EdgeRouter-BHls0yWC.mjs';
4
+ export { NodeRouter, createRouter as createNodeRouter, createRouter } from './packem_shared/createRouter-DGGDIRda.mjs';
5
+ export { Router } from './packem_shared/Router-CT_g_29S.mjs';
6
+ export { default as sendJson } from './packem_shared/sendJson-Cd6CsJC_.mjs';