@mapl/web 0.3.0-beta.2 → 0.3.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.
Files changed (2) hide show
  1. package/core/handler.d.ts +11 -4
  2. package/package.json +11 -11
package/core/handler.d.ts CHANGED
@@ -2,7 +2,10 @@ import type { Err } from "@safe-std/error";
2
2
  import type { Context } from "./context.js";
3
3
  import type { RouterTag } from "./index.js";
4
4
  import type { RequestMethod } from "./utils.js";
5
- export type HandlerResponse<I = any> = (response: string, hasContext: boolean, _?: I) => string;
5
+ export interface HandlerResponse<I = any> {
6
+ (response: string, hasContext: boolean): string;
7
+ (response: string, hasContext: boolean, _: I): string;
8
+ }
6
9
  export interface HandlerData extends Record<symbol, any> {
7
10
  type?: HandlerResponse;
8
11
  }
@@ -21,9 +24,13 @@ export type InferHandler<
21
24
  export interface DefineHandler {
22
25
  <
23
26
  P extends string,
24
- const D extends HandlerData | undefined = undefined,
25
- C = {}
26
- >(path: P, handler: NoInfer<InferHandler<P, D, C>>, dat?: D): HandlerTag<C>;
27
+ const D extends HandlerData,
28
+ C
29
+ >(path: P, handler: NoInfer<InferHandler<P, D, C>>, dat: D): HandlerTag<C>;
30
+ <
31
+ P extends string,
32
+ C
33
+ >(path: P, handler: NoInfer<InferHandler<P, undefined, C>>): HandlerTag<C>;
27
34
  }
28
35
  declare const handlerTag: unique symbol;
29
36
  export interface HandlerTag<T> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapl/web",
3
- "version": "0.3.0-beta.2",
3
+ "version": "0.3.0",
4
4
  "description": "A compiled web framework for all runtimes",
5
5
  "keywords": ["fast", "lightweight", "cross-runtime", "framework", "web", "backend"],
6
6
  "repository": {
@@ -21,20 +21,20 @@
21
21
  "secure-headers": "^0.0.6"
22
22
  },
23
23
  "exports": {
24
+ "./constants": "./constants.js",
25
+ ".": "./index.js",
26
+ "./core/middleware": "./core/middleware.js",
27
+ "./core/utils": "./core/utils.js",
24
28
  "./utils/static-headers": "./utils/static-headers.js",
29
+ "./utils/cors": "./utils/cors.js",
25
30
  "./compiler/aot": "./compiler/aot.js",
26
- "./compiler/jit": "./compiler/jit.js",
27
- "./compiler/bun/jit": "./compiler/bun/jit.js",
31
+ "./core/handler": "./core/handler.js",
28
32
  "./utils/secure-headers": "./utils/secure-headers.js",
33
+ "./compiler/bun/jit": "./compiler/bun/jit.js",
34
+ "./compiler/jit": "./compiler/jit.js",
35
+ "./compiler/bun/router": "./compiler/bun/router.js",
29
36
  "./core": "./core/index.js",
30
37
  "./compiler/bun/aot": "./compiler/bun/aot.js",
31
- "./core/utils": "./core/utils.js",
32
- "./utils/cors": "./utils/cors.js",
33
- "./core/handler": "./core/handler.js",
34
- "./core/context": "./core/context.js",
35
- "./core/middleware": "./core/middleware.js",
36
- "./constants": "./constants.js",
37
- ".": "./index.js",
38
- "./compiler/bun/router": "./compiler/bun/router.js"
38
+ "./core/context": "./core/context.js"
39
39
  }
40
40
  }