hono-adapter-aws-lambda 1.3.4 → 1.3.5
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 +0 -2
- package/dist/index.mjs +6 -5
- package/package.json +27 -24
package/README.md
CHANGED
|
@@ -58,8 +58,6 @@ See some more examples in the test file: [test/index.test.ts](test/index.test.ts
|
|
|
58
58
|
[npm-downloads-href]: https://npmjs.com/package/hono-adapter-aws-lambda
|
|
59
59
|
[codecov-src]: https://img.shields.io/codecov/c/gh/namesmt/hono-adapter-aws-lambda/main?labelColor=18181B&color=F0DB4F
|
|
60
60
|
[codecov-href]: https://codecov.io/gh/namesmt/hono-adapter-aws-lambda
|
|
61
|
-
[license-src]: https://img.shields.io/github/license/namesmt/hono-adapter-aws-lambda.svg?labelColor=18181B&color=F0DB4F
|
|
62
|
-
[license-href]: https://github.com/namesmt/hono-adapter-aws-lambda/blob/main/LICENSE
|
|
63
61
|
[bundlejs-src]: https://img.shields.io/bundlejs/size/hono-adapter-aws-lambda?labelColor=18181B&color=F0DB4F
|
|
64
62
|
[bundlejs-href]: https://bundlejs.com/?q=hono-adapter-aws-lambda
|
|
65
63
|
[jsDocs-src]: https://img.shields.io/badge/Check_out-jsDocs.io---?labelColor=18181B&color=F0DB4F
|
package/dist/index.mjs
CHANGED
|
@@ -189,6 +189,7 @@ function isProxyEventV2(event) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
const METHOD = "TRIGGER";
|
|
192
|
+
const JSON_CONTENT_TYPE_REGEX = /^application\/json/;
|
|
192
193
|
class TriggerFactory {
|
|
193
194
|
simpleRouter = {};
|
|
194
195
|
honoApp;
|
|
@@ -209,7 +210,7 @@ class TriggerFactory {
|
|
|
209
210
|
if (route[0] === "$")
|
|
210
211
|
continue;
|
|
211
212
|
const res = await this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/${route}`), c.env);
|
|
212
|
-
resObj[route] =
|
|
213
|
+
resObj[route] = JSON_CONTENT_TYPE_REGEX.test(res.headers.get("content-type") || "") ? await res.json() : await res.text();
|
|
213
214
|
}
|
|
214
215
|
if (thisEventSource["$="]) {
|
|
215
216
|
return this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/$=`), c.env);
|
|
@@ -274,16 +275,16 @@ function makeLocalRequest(method, path) {
|
|
|
274
275
|
return new Request(`http://127.0.0.1${path}`, { method });
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
const CONTENT_TYPE_TEXT_REGEX = /^(?:text\/(?:plain|html|css|javascript|csv).*|application\/(?:.*json|.*xml).*|image\/svg\+xml.*)$/;
|
|
279
|
+
const CONTENT_ENCODING_BINARY_REGEX = /^(?:gzip|deflate|compress|br)/;
|
|
277
280
|
function isContentTypeBinary(contentType) {
|
|
278
|
-
return
|
|
279
|
-
contentType
|
|
280
|
-
);
|
|
281
|
+
return !CONTENT_TYPE_TEXT_REGEX.test(contentType);
|
|
281
282
|
}
|
|
282
283
|
function isContentEncodingBinary(contentEncoding) {
|
|
283
284
|
if (contentEncoding === null) {
|
|
284
285
|
return false;
|
|
285
286
|
}
|
|
286
|
-
return
|
|
287
|
+
return CONTENT_ENCODING_BINARY_REGEX.test(contentEncoding);
|
|
287
288
|
}
|
|
288
289
|
function getProcessor(event) {
|
|
289
290
|
if (isTriggerEvent(event))
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono-adapter-aws-lambda",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.5",
|
|
5
|
+
"packageManager": "pnpm@12.4.1",
|
|
5
6
|
"description": "",
|
|
6
7
|
"author": "NamesMT <dangquoctrung123@gmail.com>",
|
|
7
8
|
"license": "MIT",
|
|
@@ -35,6 +36,22 @@
|
|
|
35
36
|
"engines": {
|
|
36
37
|
"node": ">=18.20.3"
|
|
37
38
|
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"start": "NODE_ENV=dev tsx src/index.ts",
|
|
41
|
+
"watch": "NODE_ENV=dev tsx watch src/index.ts",
|
|
42
|
+
"stub": "unbuild --stub",
|
|
43
|
+
"dev": "pnpm run watch",
|
|
44
|
+
"play": "pnpm run stub && pnpm run --filter playground dev",
|
|
45
|
+
"play:useBuild": "pnpm run build && pnpm run --filter playground dev",
|
|
46
|
+
"lint": "eslint .",
|
|
47
|
+
"test": "vitest",
|
|
48
|
+
"test:types": "tsc --noEmit --skipLibCheck",
|
|
49
|
+
"check": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
50
|
+
"build": "unbuild",
|
|
51
|
+
"release": "pnpm dlx changelogen@latest --release --push --publish",
|
|
52
|
+
"prepare": "simple-git-hooks",
|
|
53
|
+
"prepublishOnly": "pnpm run build"
|
|
54
|
+
},
|
|
38
55
|
"peerDependencies": {
|
|
39
56
|
"hono": ">=4.7.11"
|
|
40
57
|
},
|
|
@@ -45,39 +62,25 @@
|
|
|
45
62
|
},
|
|
46
63
|
"dependencies": {
|
|
47
64
|
"@namesmt/utils-lambda": "^0.1.4",
|
|
48
|
-
"@types/aws-lambda": "^8.10.
|
|
65
|
+
"@types/aws-lambda": "^8.10.163"
|
|
49
66
|
},
|
|
50
67
|
"devDependencies": {
|
|
51
|
-
"@antfu/eslint-config": "^7.
|
|
52
|
-
"@types/node": "^24.
|
|
53
|
-
"@vitest/coverage-v8": "^3.2.
|
|
68
|
+
"@antfu/eslint-config": "^7.7.3",
|
|
69
|
+
"@types/node": "^24.13.4",
|
|
70
|
+
"@vitest/coverage-v8": "^3.2.7",
|
|
54
71
|
"eslint": "^9.39.2",
|
|
55
72
|
"klona": "^2.0.6",
|
|
56
|
-
"lint-staged": "^16.
|
|
57
|
-
"simple-git-hooks": "^2.
|
|
58
|
-
"tsx": "^4.
|
|
73
|
+
"lint-staged": "^16.4.0",
|
|
74
|
+
"simple-git-hooks": "^2.14.0",
|
|
75
|
+
"tsx": "^4.23.13",
|
|
59
76
|
"typescript": "^5.9.3",
|
|
60
77
|
"unbuild": "^3.6.1",
|
|
61
|
-
"vitest": "^3.2.
|
|
78
|
+
"vitest": "^3.2.7"
|
|
62
79
|
},
|
|
63
80
|
"simple-git-hooks": {
|
|
64
81
|
"pre-commit": "pnpm lint-staged"
|
|
65
82
|
},
|
|
66
83
|
"lint-staged": {
|
|
67
84
|
"*": "eslint --fix"
|
|
68
|
-
},
|
|
69
|
-
"scripts": {
|
|
70
|
-
"start": "NODE_ENV=dev tsx src/index.ts",
|
|
71
|
-
"watch": "NODE_ENV=dev tsx watch src/index.ts",
|
|
72
|
-
"stub": "unbuild --stub",
|
|
73
|
-
"dev": "pnpm run watch",
|
|
74
|
-
"play": "pnpm run stub && pnpm run --filter playground dev",
|
|
75
|
-
"play:useBuild": "pnpm run build && pnpm run --filter playground dev",
|
|
76
|
-
"lint": "eslint .",
|
|
77
|
-
"test": "vitest",
|
|
78
|
-
"test:types": "tsc --noEmit --skipLibCheck",
|
|
79
|
-
"check": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
80
|
-
"build": "unbuild",
|
|
81
|
-
"release": "pnpm dlx changelogen@latest --release --push --publish"
|
|
82
85
|
}
|
|
83
|
-
}
|
|
86
|
+
}
|