tezx 1.0.29 → 1.0.31
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 +7 -7
- package/cjs/core/context.js +1 -0
- package/cjs/index.js +1 -1
- package/cjs/utils/formData.js +6 -3
- package/core/context.d.ts +1 -0
- package/core/context.js +1 -0
- package/index.js +1 -1
- package/middleware/secureHeaders.d.ts +1 -1
- package/package.json +1 -1
- package/utils/formData.js +6 -3
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ yarn add tezx
|
|
|
29
29
|
|
|
30
30
|
<!-- ### Deno
|
|
31
31
|
|
|
32
|
-
```
|
|
32
|
+
```ts
|
|
33
33
|
import { TezX } from "https://deno.land/x/tezx/mod.ts";
|
|
34
34
|
``` -->
|
|
35
35
|
|
|
@@ -46,10 +46,10 @@ Create a simple TezX server:
|
|
|
46
46
|
```javascript
|
|
47
47
|
import { TezX } from "tezx";
|
|
48
48
|
import { logger } from "tezx/middleware";
|
|
49
|
-
import {nodeAdapter} from "tezx/adapter";
|
|
49
|
+
import { nodeAdapter } from "tezx/adapter";
|
|
50
50
|
|
|
51
51
|
const app = new TezX();
|
|
52
|
-
app.use(logger())
|
|
52
|
+
app.use(logger());
|
|
53
53
|
|
|
54
54
|
app.static("/", "./static");
|
|
55
55
|
|
|
@@ -175,8 +175,8 @@ Add the following scripts to **`package.json`**:
|
|
|
175
175
|
|
|
176
176
|
**`src/index.ts`**
|
|
177
177
|
|
|
178
|
-
```
|
|
179
|
-
import {bunAdapter} from "tezx/adapter";
|
|
178
|
+
```ts
|
|
179
|
+
import { bunAdapter } from "tezx/adapter";
|
|
180
180
|
bunAdapter(server).listen(3000, (message) => {
|
|
181
181
|
console.log(message);
|
|
182
182
|
});
|
|
@@ -192,8 +192,8 @@ bunAdapter(server).listen(3000, (message) => {
|
|
|
192
192
|
|
|
193
193
|
**`src/index.ts`**
|
|
194
194
|
|
|
195
|
-
```
|
|
196
|
-
import {denoAdapter} from "tezx/adapter";
|
|
195
|
+
```ts
|
|
196
|
+
import { denoAdapter } from "tezx/adapter";
|
|
197
197
|
denoAdapter(server).listen(3000, (message) => {
|
|
198
198
|
console.log(message);
|
|
199
199
|
});
|
package/cjs/core/context.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -7,4 +7,4 @@ var server_1 = require("./core/server");
|
|
|
7
7
|
Object.defineProperty(exports, "TezX", { enumerable: true, get: function () { return server_1.TezX; } });
|
|
8
8
|
var params_1 = require("./utils/params");
|
|
9
9
|
Object.defineProperty(exports, "useParams", { enumerable: true, get: function () { return params_1.useParams; } });
|
|
10
|
-
exports.version = "1.0.
|
|
10
|
+
exports.version = "1.0.31";
|
package/cjs/utils/formData.js
CHANGED
|
@@ -155,14 +155,16 @@ async function parseMultipartBody(req, boundary, options) {
|
|
|
155
155
|
}
|
|
156
156
|
if (formDataField[fieldName]) {
|
|
157
157
|
if (Array.isArray(formDataField[fieldName])) {
|
|
158
|
+
const existingFiles = formDataField[fieldName].filter((f) => f instanceof File);
|
|
158
159
|
if (typeof options?.maxFiles != "undefined" &&
|
|
159
|
-
|
|
160
|
+
existingFiles.length >= options.maxFiles) {
|
|
160
161
|
reject(new Error(`Field "${fieldName}" exceeds the maximum allowed file count of ${options.maxFiles}.`));
|
|
161
162
|
}
|
|
162
163
|
formDataField[fieldName].push(file);
|
|
163
164
|
}
|
|
164
165
|
else {
|
|
165
|
-
if (
|
|
166
|
+
if (formDataField[fieldName] instanceof File &&
|
|
167
|
+
typeof options?.maxFiles != "undefined" &&
|
|
166
168
|
options.maxFiles == 1) {
|
|
167
169
|
reject(new Error(`Field "${fieldName}" exceeds the maximum allowed file count of ${options.maxFiles}.`));
|
|
168
170
|
}
|
|
@@ -218,7 +220,8 @@ async function parseMultipartBody(req, boundary, options) {
|
|
|
218
220
|
}
|
|
219
221
|
else {
|
|
220
222
|
if (val instanceof File &&
|
|
221
|
-
typeof options?.maxFiles != "undefined" &&
|
|
223
|
+
typeof options?.maxFiles != "undefined" &&
|
|
224
|
+
options.maxFiles == 1) {
|
|
222
225
|
throw new Error(`Field "${key}" exceeds the maximum allowed file count of ${options.maxFiles}.`);
|
|
223
226
|
}
|
|
224
227
|
result[key] = [result[key], val];
|
package/core/context.d.ts
CHANGED
package/core/context.js
CHANGED
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export type SecurityHeaderOptions = {
|
|
|
15
15
|
* @default true
|
|
16
16
|
* @example
|
|
17
17
|
* frameGuard: true // Always enable
|
|
18
|
-
* frameGuard: (ctx) => !ctx.
|
|
18
|
+
* frameGuard: (ctx) => !ctx.pathname.startsWith('/embed/') // Disable for embed routes
|
|
19
19
|
*/
|
|
20
20
|
frameGuard?: boolean | ((ctx: Context) => boolean);
|
|
21
21
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tezx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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",
|
package/utils/formData.js
CHANGED
|
@@ -149,14 +149,16 @@ export async function parseMultipartBody(req, boundary, options) {
|
|
|
149
149
|
}
|
|
150
150
|
if (formDataField[fieldName]) {
|
|
151
151
|
if (Array.isArray(formDataField[fieldName])) {
|
|
152
|
+
const existingFiles = formDataField[fieldName].filter((f) => f instanceof File);
|
|
152
153
|
if (typeof options?.maxFiles != "undefined" &&
|
|
153
|
-
|
|
154
|
+
existingFiles.length >= options.maxFiles) {
|
|
154
155
|
reject(new Error(`Field "${fieldName}" exceeds the maximum allowed file count of ${options.maxFiles}.`));
|
|
155
156
|
}
|
|
156
157
|
formDataField[fieldName].push(file);
|
|
157
158
|
}
|
|
158
159
|
else {
|
|
159
|
-
if (
|
|
160
|
+
if (formDataField[fieldName] instanceof File &&
|
|
161
|
+
typeof options?.maxFiles != "undefined" &&
|
|
160
162
|
options.maxFiles == 1) {
|
|
161
163
|
reject(new Error(`Field "${fieldName}" exceeds the maximum allowed file count of ${options.maxFiles}.`));
|
|
162
164
|
}
|
|
@@ -212,7 +214,8 @@ export async function parseMultipartBody(req, boundary, options) {
|
|
|
212
214
|
}
|
|
213
215
|
else {
|
|
214
216
|
if (val instanceof File &&
|
|
215
|
-
typeof options?.maxFiles != "undefined" &&
|
|
217
|
+
typeof options?.maxFiles != "undefined" &&
|
|
218
|
+
options.maxFiles == 1) {
|
|
216
219
|
throw new Error(`Field "${key}" exceeds the maximum allowed file count of ${options.maxFiles}.`);
|
|
217
220
|
}
|
|
218
221
|
result[key] = [result[key], val];
|