hono 3.2.1 → 3.2.2
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/cjs/middleware/basic-auth/index.js +5 -1
- package/dist/cjs/middleware/cache/index.js +1 -1
- package/dist/cjs/middleware/cors/index.js +2 -2
- package/dist/cjs/middleware/etag/index.js +1 -1
- package/dist/cjs/middleware/powered-by/index.js +1 -1
- package/dist/middleware/basic-auth/index.js +5 -1
- package/dist/middleware/cache/index.js +1 -1
- package/dist/middleware/cors/index.js +2 -2
- package/dist/middleware/etag/index.js +1 -1
- package/dist/middleware/powered-by/index.js +1 -1
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
[](https://discord.gg/KMh2eNSdxV)
|
|
27
27
|
|
|
28
28
|
Hono - _**\[炎\] means flame🔥 in Japanese**_ - is a small, simple, and ultrafast web framework for the Edges.
|
|
29
|
-
It works on any
|
|
29
|
+
It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute@Edge, Deno, Bun, Vercel, Lagon, AWS Lambda, and Node.js.
|
|
30
30
|
|
|
31
31
|
Fast, but not only fast.
|
|
32
32
|
|
|
@@ -32,7 +32,11 @@ const auth = (req) => {
|
|
|
32
32
|
if (!match) {
|
|
33
33
|
return void 0;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
let userPass = void 0;
|
|
36
|
+
try {
|
|
37
|
+
userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode((0, import_encode.decodeBase64)(match[1])));
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
36
40
|
if (!userPass) {
|
|
37
41
|
return void 0;
|
|
38
42
|
}
|
|
@@ -27,7 +27,7 @@ const cache = (options) => {
|
|
|
27
27
|
}
|
|
28
28
|
const addHeader = (response) => {
|
|
29
29
|
if (options.cacheControl)
|
|
30
|
-
response.headers.
|
|
30
|
+
response.headers.set("Cache-Control", options.cacheControl);
|
|
31
31
|
};
|
|
32
32
|
return async (c, next) => {
|
|
33
33
|
const key = c.req.url;
|
|
@@ -43,7 +43,7 @@ const cors = (options) => {
|
|
|
43
43
|
})(opts.origin);
|
|
44
44
|
return async (c, next) => {
|
|
45
45
|
function set(key, value) {
|
|
46
|
-
c.res.headers.
|
|
46
|
+
c.res.headers.set(key, value);
|
|
47
47
|
}
|
|
48
48
|
const allowOrigin = findAllowOrigin(c.req.headers.get("origin") || "");
|
|
49
49
|
if (allowOrigin) {
|
|
@@ -76,7 +76,7 @@ const cors = (options) => {
|
|
|
76
76
|
}
|
|
77
77
|
if (headers?.length) {
|
|
78
78
|
set("Access-Control-Allow-Headers", headers.join(","));
|
|
79
|
-
|
|
79
|
+
c.res.headers.append("Vary", "Access-Control-Request-Headers");
|
|
80
80
|
}
|
|
81
81
|
c.res.headers.delete("Content-Length");
|
|
82
82
|
c.res.headers.delete("Content-Type");
|
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(powered_by_exports);
|
|
|
24
24
|
const poweredBy = () => {
|
|
25
25
|
return async (c, next) => {
|
|
26
26
|
await next();
|
|
27
|
-
c.res.headers.
|
|
27
|
+
c.res.headers.set("X-Powered-By", "Hono");
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -10,7 +10,11 @@ var auth = (req) => {
|
|
|
10
10
|
if (!match) {
|
|
11
11
|
return void 0;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
let userPass = void 0;
|
|
14
|
+
try {
|
|
15
|
+
userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode(decodeBase64(match[1])));
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
14
18
|
if (!userPass) {
|
|
15
19
|
return void 0;
|
|
16
20
|
}
|
|
@@ -5,7 +5,7 @@ var cache = (options) => {
|
|
|
5
5
|
}
|
|
6
6
|
const addHeader = (response) => {
|
|
7
7
|
if (options.cacheControl)
|
|
8
|
-
response.headers.
|
|
8
|
+
response.headers.set("Cache-Control", options.cacheControl);
|
|
9
9
|
};
|
|
10
10
|
return async (c, next) => {
|
|
11
11
|
const key = c.req.url;
|
|
@@ -21,7 +21,7 @@ var cors = (options) => {
|
|
|
21
21
|
})(opts.origin);
|
|
22
22
|
return async (c, next) => {
|
|
23
23
|
function set(key, value) {
|
|
24
|
-
c.res.headers.
|
|
24
|
+
c.res.headers.set(key, value);
|
|
25
25
|
}
|
|
26
26
|
const allowOrigin = findAllowOrigin(c.req.headers.get("origin") || "");
|
|
27
27
|
if (allowOrigin) {
|
|
@@ -54,7 +54,7 @@ var cors = (options) => {
|
|
|
54
54
|
}
|
|
55
55
|
if (headers?.length) {
|
|
56
56
|
set("Access-Control-Allow-Headers", headers.join(","));
|
|
57
|
-
|
|
57
|
+
c.res.headers.append("Vary", "Access-Control-Request-Headers");
|
|
58
58
|
}
|
|
59
59
|
c.res.headers.delete("Content-Length");
|
|
60
60
|
c.res.headers.delete("Content-Type");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Ultrafast web framework for the Edges",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -145,6 +145,16 @@
|
|
|
145
145
|
"import": "./dist/router/trie-router/index.js",
|
|
146
146
|
"require": "./dist/cjs/router/trie-router/index.js"
|
|
147
147
|
},
|
|
148
|
+
"./router/pattern-router": {
|
|
149
|
+
"types": "./dist/types/router/pattern-router/index.d.ts",
|
|
150
|
+
"import": "./dist/router/pattern-router/index.js",
|
|
151
|
+
"require": "./dist/cjs/router/pattern-router/index.js"
|
|
152
|
+
},
|
|
153
|
+
"./router/linear-router": {
|
|
154
|
+
"types": "./dist/types/router/linear-router/index.d.ts",
|
|
155
|
+
"import": "./dist/router/linear-router/index.js",
|
|
156
|
+
"require": "./dist/cjs/router/linear-router/index.js"
|
|
157
|
+
},
|
|
148
158
|
"./utils/jwt": {
|
|
149
159
|
"types": "./dist/types/utils/jwt/index.d.ts",
|
|
150
160
|
"import": "./dist/utils/jwt/index.js",
|
|
@@ -269,6 +279,12 @@
|
|
|
269
279
|
"router/trie-router": [
|
|
270
280
|
"./dist/types/router/trie-router/router.d.ts"
|
|
271
281
|
],
|
|
282
|
+
"router/pattern-router": [
|
|
283
|
+
"./dist/types/router/pattern-router/router.d.ts"
|
|
284
|
+
],
|
|
285
|
+
"router/linear-router": [
|
|
286
|
+
"./dist/types/router/linear-router/router.d.ts"
|
|
287
|
+
],
|
|
272
288
|
"utils/jwt": [
|
|
273
289
|
"./dist/types/utils/jwt/index.d.ts"
|
|
274
290
|
],
|