tezx 3.0.9-beta → 3.0.10-beta
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/cjs/core/context.js +1 -4
- package/cjs/core/router.js +2 -4
- package/cjs/index.js +1 -1
- package/cjs/utils/response.js +1 -1
- package/core/context.d.ts +0 -9
- package/core/context.js +1 -4
- package/core/router.js +2 -4
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils/response.js +1 -1
package/cjs/core/context.js
CHANGED
|
@@ -74,9 +74,6 @@ class Context {
|
|
|
74
74
|
}
|
|
75
75
|
return this;
|
|
76
76
|
}
|
|
77
|
-
get params() {
|
|
78
|
-
return this.#params;
|
|
79
|
-
}
|
|
80
77
|
set params(params) {
|
|
81
78
|
this.#params = params;
|
|
82
79
|
}
|
|
@@ -135,7 +132,7 @@ class Context {
|
|
|
135
132
|
redirect(url, status = 302) {
|
|
136
133
|
return new Response(null, {
|
|
137
134
|
status: status,
|
|
138
|
-
headers: { Location: url },
|
|
135
|
+
headers: { ...this.#headers, Location: url },
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
138
|
async download(filePath, filename) {
|
package/cjs/core/router.js
CHANGED
|
@@ -129,11 +129,9 @@ class Router {
|
|
|
129
129
|
}
|
|
130
130
|
return this;
|
|
131
131
|
}
|
|
132
|
-
#addRoute(method, path, handlers
|
|
132
|
+
#addRoute(method, path, handlers) {
|
|
133
133
|
let pattern = `/${(0, low_level_js_1.sanitizePathSplitBasePath)(this.basePath, path).join("/")}`;
|
|
134
|
-
|
|
135
|
-
this.router.addRoute(method, pattern, handlers);
|
|
136
|
-
}
|
|
134
|
+
this.router.addRoute(method, pattern, handlers);
|
|
137
135
|
this.route.push({
|
|
138
136
|
method: method,
|
|
139
137
|
pattern: pattern,
|
package/cjs/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const router_js_1 = require("./core/router.js");
|
|
|
5
5
|
Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return router_js_1.Router; } });
|
|
6
6
|
const server_js_1 = require("./core/server.js");
|
|
7
7
|
Object.defineProperty(exports, "TezX", { enumerable: true, get: function () { return server_js_1.TezX; } });
|
|
8
|
-
exports.version = "3.0.
|
|
8
|
+
exports.version = "3.0.10-beta";
|
|
9
9
|
exports.default = {
|
|
10
10
|
Router: router_js_1.Router,
|
|
11
11
|
TezX: server_js_1.TezX,
|
package/cjs/utils/response.js
CHANGED
|
@@ -38,7 +38,7 @@ function determineContentTypeBody(body) {
|
|
|
38
38
|
if (typeof Blob !== "undefined" && body instanceof Blob) {
|
|
39
39
|
return { type: body.type || "application/octet-stream", body };
|
|
40
40
|
}
|
|
41
|
-
if (typeof body === "object" && typeof body
|
|
41
|
+
if (typeof body === "object" && typeof body?.pipe === "function") {
|
|
42
42
|
return { type: "application/octet-stream", body };
|
|
43
43
|
}
|
|
44
44
|
if (typeof body === "object") {
|
package/core/context.d.ts
CHANGED
|
@@ -102,15 +102,6 @@ export declare class Context<T extends Record<string, any> = {}, Path extends st
|
|
|
102
102
|
* @returns {this} Returns the current instance for method chaining.
|
|
103
103
|
*/
|
|
104
104
|
deleteHeader(key: ResHeaderKey): this;
|
|
105
|
-
/**
|
|
106
|
-
* Gets the route parameters extracted from the URL.
|
|
107
|
-
*
|
|
108
|
-
* @returns {Record<string, any>} An object containing key-value pairs of route parameters.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* // For route `/user/:id` and URL `/user/123`, it returns: { id: "123" }
|
|
112
|
-
*/
|
|
113
|
-
get params(): Record<string, any>;
|
|
114
105
|
protected set params(params: Record<string, any>);
|
|
115
106
|
/**
|
|
116
107
|
* Gets the wrapped request object (`TezXRequest`).
|
package/core/context.js
CHANGED
|
@@ -71,9 +71,6 @@ export class Context {
|
|
|
71
71
|
}
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
|
-
get params() {
|
|
75
|
-
return this.#params;
|
|
76
|
-
}
|
|
77
74
|
set params(params) {
|
|
78
75
|
this.#params = params;
|
|
79
76
|
}
|
|
@@ -132,7 +129,7 @@ export class Context {
|
|
|
132
129
|
redirect(url, status = 302) {
|
|
133
130
|
return new Response(null, {
|
|
134
131
|
status: status,
|
|
135
|
-
headers: { Location: url },
|
|
132
|
+
headers: { ...this.#headers, Location: url },
|
|
136
133
|
});
|
|
137
134
|
}
|
|
138
135
|
async download(filePath, filename) {
|
package/core/router.js
CHANGED
|
@@ -126,11 +126,9 @@ export class Router {
|
|
|
126
126
|
}
|
|
127
127
|
return this;
|
|
128
128
|
}
|
|
129
|
-
#addRoute(method, path, handlers
|
|
129
|
+
#addRoute(method, path, handlers) {
|
|
130
130
|
let pattern = `/${sanitizePathSplitBasePath(this.basePath, path).join("/")}`;
|
|
131
|
-
|
|
132
|
-
this.router.addRoute(method, pattern, handlers);
|
|
133
|
-
}
|
|
131
|
+
this.router.addRoute(method, pattern, handlers);
|
|
134
132
|
this.route.push({
|
|
135
133
|
method: method,
|
|
136
134
|
pattern: pattern,
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Router } from "./core/router.js";
|
|
2
2
|
import { TezX } from "./core/server.js";
|
|
3
3
|
export type { Context as BaseContext } from "./core/context.js";
|
|
4
|
-
export type { NetAddr as AddressType, Callback, Ctx as Context, CookieOptions, ErrorHandler, FormDataOptions, HandlerType, HttpBaseResponse, HTTPMethod, Middleware,
|
|
4
|
+
export type { NetAddr as AddressType, Callback, Ctx as Context, CookieOptions, ErrorHandler, FormDataOptions, HandlerType, HttpBaseResponse, HTTPMethod, Middleware, NextCallback, RequestHeaders, ResponseHeaders, ResponseInit, RouteMatchResult, RouteRegistry, Runtime, StaticFileArray, StaticServeOption, WebSocketCallback, WebSocketEvent, WebSocketOptions } from "./types/index.js";
|
|
5
5
|
export type { TezXConfig } from "./core/server.js";
|
|
6
|
-
export type { RouterConfig } from "./core/router.js";
|
|
7
6
|
export type { TezXRequest } from "./core/request.js";
|
|
7
|
+
export type { RouterConfig } from "./core/router.js";
|
|
8
8
|
export { Router, TezX };
|
|
9
9
|
export declare let version: string;
|
|
10
10
|
declare const _default: {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tezx",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10-beta",
|
|
4
4
|
"description": "TezX is a high-performance, lightweight JavaScript framework designed for speed, scalability, and flexibility. It enables efficient routing, middleware management, and static file serving with minimal configuration. Fully compatible with Node.js, Deno, and Bun.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cjs/index.js",
|
package/utils/response.js
CHANGED
|
@@ -31,7 +31,7 @@ export function determineContentTypeBody(body) {
|
|
|
31
31
|
if (typeof Blob !== "undefined" && body instanceof Blob) {
|
|
32
32
|
return { type: body.type || "application/octet-stream", body };
|
|
33
33
|
}
|
|
34
|
-
if (typeof body === "object" && typeof body
|
|
34
|
+
if (typeof body === "object" && typeof body?.pipe === "function") {
|
|
35
35
|
return { type: "application/octet-stream", body };
|
|
36
36
|
}
|
|
37
37
|
if (typeof body === "object") {
|