diesel-core 1.7.4 → 2.0.1
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/README.md +1 -1
- package/dist/constant.js +1 -1
- package/dist/ctx.d.ts +11 -11
- package/dist/ctx.js +40 -142
- package/dist/http-exception.js +1 -1
- package/dist/main.d.ts +4 -2
- package/dist/main.js +40 -142
- package/dist/middlewares/filesave/savefile.js +1 -1
- package/dist/middlewares/request-id/index.js +1 -0
- package/dist/request_pipeline.js +118 -0
- package/dist/router/interface.d.ts +6 -18
- package/dist/router/interface.js +117 -101
- package/dist/router/old-trie.d.ts +8 -0
- package/dist/router/trie-with-obj.d.ts +25 -0
- package/dist/router/trie.d.ts +20 -32
- package/dist/router/trie.js +118 -1
- package/dist/types.d.ts +1 -0
- package/package.json +6 -7
- package/dist/adaptor/node/conninfo.js +0 -37
- package/dist/adaptor/node/main.js +0 -112
- package/dist/handleRequest.js +0 -220
- package/dist/router/find-my-way.d.ts +0 -8
- package/dist/router/find-my-way.js +0 -102
- package/dist/router/trie2.d.ts +0 -34
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# DieselJS
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
**Diesel** is a simple and lightweight HTTP server library for Bun.js that provides you with complete control over your API routes and middleware. It is designed to be intuitive and efficient, allowing you to quickly set up a server, define routes, and optimize important paths for faster response times.
|
|
6
|
+
**Diesel** is a simple and lightweight HTTP server library for Bun.js that provides you with complete control over your API routes and middleware. It is designed to be intuitive and efficient, allowing you to quickly set up a server, define routes, and optimize important paths for faster response times. started this on 5th october 2024
|
|
7
7
|
|
|
8
8
|
**Now Supports Node.js & Cloduflare adaptors**
|
|
9
9
|
|
package/dist/constant.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=["GET","POST","PUT","PATCH","DELETE","ANY","ALL","HEAD","OPTIONS","PROPFIND"];export{P as supportedMethods};
|
package/dist/ctx.d.ts
CHANGED
|
@@ -2,19 +2,18 @@ import { Server } from "bun";
|
|
|
2
2
|
import type { CookieOptions } from "./types";
|
|
3
3
|
export declare class Context {
|
|
4
4
|
req: Request;
|
|
5
|
-
server
|
|
5
|
+
server?: Server;
|
|
6
6
|
path: string | null;
|
|
7
|
-
|
|
8
|
-
env
|
|
9
|
-
executionContext
|
|
10
|
-
headers: Headers;
|
|
7
|
+
param: Record<string, string> | undefined;
|
|
8
|
+
env?: Record<string, any>;
|
|
9
|
+
executionContext?: any;
|
|
10
|
+
headers: Headers | null;
|
|
11
11
|
private parsedQuery;
|
|
12
|
-
private parsedParams;
|
|
13
12
|
private parsedCookies;
|
|
14
13
|
private parsedBody;
|
|
15
14
|
private contextData;
|
|
16
15
|
private urlObject;
|
|
17
|
-
constructor(req: Request, server: Server |
|
|
16
|
+
constructor(req: Request, server: Server | undefined, path: string | null, param: Record<string, string> | undefined, env: Record<string, any> | undefined, executionContext: any | undefined);
|
|
18
17
|
setHeader(key: string, value: string): this;
|
|
19
18
|
removeHeader(key: string): this;
|
|
20
19
|
set<T>(key: string, value: T): this;
|
|
@@ -24,10 +23,10 @@ export declare class Context {
|
|
|
24
23
|
get query(): Record<string, string>;
|
|
25
24
|
get params(): Record<string, string>;
|
|
26
25
|
get body(): Promise<any>;
|
|
27
|
-
text(data: string, status?: number, customHeaders?:
|
|
28
|
-
send<T>(data: T, status?: number, customHeaders?:
|
|
29
|
-
json<T>(object: T, status?: number, customHeaders?:
|
|
30
|
-
file(filePath: string, mimeType?: string, status?: number, customHeaders?:
|
|
26
|
+
text(data: string, status?: number, customHeaders?: Record<string, string>): Response;
|
|
27
|
+
send<T>(data: T, status?: number, customHeaders?: Record<string, string>): Response;
|
|
28
|
+
json<T>(object: T, status?: number, customHeaders?: Record<string, string>): Response;
|
|
29
|
+
file(filePath: string, mimeType?: string, status?: number, customHeaders?: Record<string, string>): Response;
|
|
31
30
|
ejs(viewPath: string, data?: {}, status?: number): Promise<void>;
|
|
32
31
|
redirect(path: string, status?: number): Response;
|
|
33
32
|
setCookie(name: string, value: string, options?: CookieOptions): this;
|
|
@@ -37,3 +36,4 @@ export declare class Context {
|
|
|
37
36
|
}
|
|
38
37
|
export declare function extractParam(paramNames: string[], incomingPath: string): Record<string, string>;
|
|
39
38
|
export declare function extractDynamicParams(originalPath: string, incomingPath: string): Record<string, string> | null;
|
|
39
|
+
export declare function parseParams(inComingpath: string | null, param: Record<string, number> | null): Record<string, any>;
|