shokupan 0.3.0 → 0.4.5

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.
@@ -6,6 +6,7 @@ export interface RequestLog {
6
6
  status: number;
7
7
  duration: number;
8
8
  timestamp: number;
9
+ handlerStack?: any[];
9
10
  }
10
11
  export interface DebugDashboardConfig {
11
12
  getRequestHeaders?: () => Record<string, string>;
@@ -4,12 +4,12 @@ import { ShokupanRouter } from '../router';
4
4
  import { DeepPartial } from '../types';
5
5
  export type ScalarPluginOptions = {
6
6
  baseDocument?: DeepPartial<OpenAPI.Document>;
7
- config: Partial<ApiReferenceConfiguration>;
7
+ config?: Partial<ApiReferenceConfiguration>;
8
8
  enableStaticAnalysis?: boolean;
9
9
  };
10
10
  export declare class ScalarPlugin extends ShokupanRouter<any> {
11
11
  private readonly pluginOptions;
12
- constructor(pluginOptions: ScalarPluginOptions);
12
+ constructor(pluginOptions?: ScalarPluginOptions);
13
13
  init(): void;
14
14
  onMount(parent: ShokupanRouter<any>): void;
15
15
  }
package/dist/router.d.ts CHANGED
@@ -83,21 +83,31 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
83
83
  _fn: Middleware;
84
84
  }[];
85
85
  routes: {
86
- type: string;
86
+ type: 'route';
87
87
  path: string;
88
88
  method: Method;
89
89
  metadata: RouteMetadata;
90
90
  handlerName: string;
91
- tags: any;
91
+ tags: string[];
92
92
  order: number;
93
- _fn: ShokupanHandler<Record<string, any>>;
93
+ _fn: ShokupanHandler<T>;
94
+ }[];
95
+ routers: {
96
+ type: 'router';
97
+ path: string;
98
+ metadata: RouteMetadata;
99
+ children: {
100
+ routes: any[];
101
+ };
94
102
  }[];
95
- routers: any;
96
103
  controllers: {
97
- type: string;
98
- path: any;
104
+ type: 'controller';
105
+ path: string;
99
106
  name: string;
100
- metadata: any;
107
+ metadata: RouteMetadata;
108
+ children: {
109
+ routes: any[];
110
+ };
101
111
  }[];
102
112
  };
103
113
  constructor(config?: ShokupanRouteConfig);
@@ -160,7 +170,7 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
160
170
  * @param handler - Route handler function
161
171
  * @param requestTimeout - Timeout for this route in milliseconds
162
172
  */
163
- add({ method, path, spec, handler, regex: customRegex, group, requestTimeout, renderer }: {
173
+ add({ method, path, spec, handler, regex: customRegex, group, requestTimeout, renderer, controller }: {
164
174
  method: Method;
165
175
  path: string;
166
176
  spec?: MethodAPISpec;
@@ -169,6 +179,7 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
169
179
  group?: string;
170
180
  requestTimeout?: number;
171
181
  renderer?: JSXRenderer;
182
+ controller?: any;
172
183
  }): this;
173
184
  /**
174
185
  * Adds a GET route to the router.
@@ -39,7 +39,7 @@ export declare class Shokupan<T = any> extends ShokupanRouter<T> {
39
39
  * @param port - The port to listen on. If not specified, the port from the configuration is used. If that is not specified, port 3000 is used.
40
40
  * @returns The server instance.
41
41
  */
42
- listen(port?: number): Promise<Bun.Server<any>>;
42
+ listen(port?: number): Promise<any>;
43
43
  [$dispatch](req: ShokupanRequest<T>): Promise<Response>;
44
44
  /**
45
45
  * Processes a request by wrapping the standard fetch method.
package/dist/types.d.ts CHANGED
@@ -166,6 +166,10 @@ export type ShokupanRoute = {
166
166
  * Order of the middleware
167
167
  */
168
168
  order?: number;
169
+ /**
170
+ * Controller instance this route belongs to
171
+ */
172
+ controller?: any;
169
173
  };
170
174
  export type ShokupanConfig<T extends Record<string, any> = Record<string, any>> = DeepPartial<{
171
175
  /**
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "shokupan",
3
- "version": "0.3.0",
3
+ "version": "0.4.5",
4
4
  "description": "Shokupan is a low-lift modern web framework for Bun.",
5
5
  "author": "Andrew G. Knackstedt",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "provenance": true
9
+ },
6
10
  "repository": {
7
- "url": "https://github.com/knackstedt/shokupan"
11
+ "url": "git+https://github.com/knackstedt/shokupan.git"
8
12
  },
9
13
  "license": "MIT",
10
14
  "keywords": [
@@ -20,13 +24,14 @@
20
24
  "scripts": {
21
25
  "dev": "bun --watch --inspect src/example/main.ts",
22
26
  "debug:otel": "sh scripts/debug-otel.sh",
27
+ "docs": "cd docs && bun run dev",
23
28
  "build": "vite build",
24
29
  "bench": "cd src/benchmarking && bun runner.ts",
25
30
  "bench:advanced": "cd src/benchmarking && bun advanced-runner.ts"
26
31
  },
27
32
  "bin": {
28
- "shokupan": "./dist/cli.js",
29
- "skp": "./dist/cli.js"
33
+ "shokupan": "dist/cli.js",
34
+ "skp": "dist/cli.js"
30
35
  },
31
36
  "files": [
32
37
  "dist",