tezx 1.0.75-beta → 1.0.77

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.
@@ -1,4 +1,4 @@
1
1
  export type AdapterType = "bun" | "deno" | "node";
2
2
  export * from "./bun.js";
3
3
  export * from "./deno.js";
4
- export * from "./node/index.js";
4
+ export * from "./node.js";
package/adapter/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from "./bun.js";
2
2
  export * from "./deno.js";
3
- export * from "./node/index.js";
3
+ export * from "./node.js";
@@ -1,6 +1,6 @@
1
1
  import type { ServerOptions } from "node:http";
2
2
  import type { TlsOptions } from "node:tls";
3
- import { TezX } from "../../core/server.js";
3
+ import { TezX } from "../core/server.js";
4
4
  type UnixSocketOptions = ServerOptions & {
5
5
  unix?: string;
6
6
  enableSSL?: false;
@@ -1,10 +1,10 @@
1
1
  import { Buffer } from "node:buffer";
2
- import { GlobalConfig } from "../../core/config.js";
3
- import { Context } from "../../core/context.js";
2
+ import { GlobalConfig } from "../core/config.js";
3
+ import { Context } from "../core/context.js";
4
4
  export function nodeAdapter(TezX, options = {}) {
5
5
  function listen(...arg) {
6
6
  let ssl = options?.enableSSL;
7
- import(ssl ? "node:https" : "node:http")
7
+ return import(ssl ? "node:https" : "node:http")
8
8
  .then((r) => {
9
9
  GlobalConfig.adapter = "node";
10
10
  let server = r.createServer(options, async (req, res) => {
@@ -73,6 +73,7 @@ export function nodeAdapter(TezX, options = {}) {
73
73
  callback();
74
74
  return server;
75
75
  });
76
+ return server;
76
77
  })
77
78
  .catch((r) => {
78
79
  throw Error(r.message);
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./bun.js"), exports);
18
18
  __exportStar(require("./deno.js"), exports);
19
- __exportStar(require("./node/index.js"), exports);
19
+ __exportStar(require("./node.js"), exports);
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nodeAdapter = nodeAdapter;
4
4
  const node_buffer_1 = require("node:buffer");
5
- const config_js_1 = require("../../core/config.js");
6
- const context_js_1 = require("../../core/context.js");
5
+ const config_js_1 = require("../core/config.js");
6
+ const context_js_1 = require("../core/context.js");
7
7
  function nodeAdapter(TezX, options = {}) {
8
8
  function listen(...arg) {
9
9
  let ssl = options?.enableSSL;
10
- Promise.resolve(`${ssl ? "node:https" : "node:http"}`).then(s => require(s)).then((r) => {
10
+ return Promise.resolve(`${ssl ? "node:https" : "node:http"}`).then(s => require(s)).then((r) => {
11
11
  config_js_1.GlobalConfig.adapter = "node";
12
12
  let server = r.createServer(options, async (req, res) => {
13
13
  let address = {};
@@ -75,6 +75,7 @@ function nodeAdapter(TezX, options = {}) {
75
75
  callback();
76
76
  return server;
77
77
  });
78
+ return server;
78
79
  })
79
80
  .catch((r) => {
80
81
  throw Error(r.message);
@@ -198,16 +198,16 @@ class TezX extends router_js_1.Router {
198
198
  }
199
199
  let finalResponse = () => {
200
200
  return (ctx) => {
201
- for (const [key, value] of response?.headers.entries()) {
201
+ let headers = response?.headers;
202
+ for (const [key, value] of headers.entries()) {
202
203
  ctx.headers.set(key, value);
203
204
  }
204
205
  const statusText = response?.statusText || httpStatusMap_js_1.httpStatusMap[response?.status] || "";
205
206
  const status = response.status || ctx.getStatus;
206
- let headers = ctx.headers.toJSON();
207
207
  return new Response(response.body, {
208
208
  status,
209
209
  statusText,
210
- headers,
210
+ headers: ctx.headers,
211
211
  });
212
212
  };
213
213
  };
package/cjs/index.js CHANGED
@@ -7,4 +7,4 @@ var server_js_1 = require("./core/server.js");
7
7
  Object.defineProperty(exports, "TezX", { enumerable: true, get: function () { return server_js_1.TezX; } });
8
8
  var params_js_1 = require("./utils/params.js");
9
9
  Object.defineProperty(exports, "useParams", { enumerable: true, get: function () { return params_js_1.useParams; } });
10
- exports.version = "1.0.75-beta";
10
+ exports.version = "1.0.77";
package/core/request.d.ts CHANGED
@@ -91,13 +91,13 @@ export declare class Request {
91
91
  /**
92
92
  * Returns an iterator over all header keys.
93
93
  * This allows iteration over the names of all headers in the request.
94
- * @returns IterableIterator of header names.
94
+ * @returns HeadersIterator of header names.
95
95
  * @example
96
96
  * for (let key of headers.keys()) {
97
97
  * console.log(key);
98
98
  * }
99
99
  */
100
- keys: () => IterableIterator<string>;
100
+ keys: () => HeadersIterator<string>;
101
101
  /**
102
102
  * Returns an iterator over all header values.
103
103
  * This allows iteration over the values of all headers, with each value being an array of strings.
package/core/server.js CHANGED
@@ -195,16 +195,16 @@ export class TezX extends Router {
195
195
  }
196
196
  let finalResponse = () => {
197
197
  return (ctx) => {
198
- for (const [key, value] of response?.headers.entries()) {
198
+ let headers = response?.headers;
199
+ for (const [key, value] of headers.entries()) {
199
200
  ctx.headers.set(key, value);
200
201
  }
201
202
  const statusText = response?.statusText || httpStatusMap[response?.status] || "";
202
203
  const status = response.status || ctx.getStatus;
203
- let headers = ctx.headers.toJSON();
204
204
  return new Response(response.body, {
205
205
  status,
206
206
  statusText,
207
- headers,
207
+ headers: ctx.headers,
208
208
  });
209
209
  };
210
210
  };
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { Router } from "./core/router.js";
2
- export type { Callback, ctx as Context, Middleware, NextCallback, RouterConfig, StaticServeOption, } from "./core/router.js";
2
+ export type { Callback, ctx as Context, Middleware, NextCallback, RouterConfig, StaticServeOption } from "./core/router.js";
3
3
  export type { CookieOptions, ResponseHeaders } from "./core/context.js";
4
- export type { NetAddr as AddressType, ConnAddress, FormDataOptions, HTTPMethod, } from "./core/request.js";
4
+ export type { NetAddr as AddressType, ConnAddress, FormDataOptions, HTTPMethod } from "./core/request.js";
5
5
  export { TezX } from "./core/server.js";
6
6
  export type { TezXConfig } from "./core/server.js";
7
7
  export { useParams } from "./utils/params.js";
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Router } from "./core/router.js";
2
2
  export { TezX } from "./core/server.js";
3
3
  export { useParams } from "./utils/params.js";
4
- export let version = "1.0.75-beta";
4
+ export let version = "1.0.77";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tezx",
3
- "version": "1.0.75-beta",
3
+ "version": "1.0.77",
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
  "main": "cjs/index.js",
6
6
  "module": "index.js",