@thi.ng/server 0.12.16 → 0.12.19
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/interceptors/cache-control.js +1 -1
- package/interceptors/inject-headers.js +1 -1
- package/package.json +16 -16
- package/server.js +2 -2
- package/utils/cookies.js +1 -1
- package/utils/formdata.js +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 211 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/server",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.19",
|
|
4
4
|
"description": "Minimal HTTP server with declarative routing, static file serving and freely extensible via pre/post interceptors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/arrays": "^2.14.
|
|
44
|
-
"@thi.ng/cache": "^2.3.
|
|
45
|
-
"@thi.ng/checks": "^3.
|
|
46
|
-
"@thi.ng/errors": "^2.5.
|
|
47
|
-
"@thi.ng/file-io": "^2.2.
|
|
48
|
-
"@thi.ng/leaky-bucket": "^0.2.
|
|
49
|
-
"@thi.ng/logger": "^3.2.
|
|
50
|
-
"@thi.ng/mime": "^2.
|
|
51
|
-
"@thi.ng/paths": "^5.2.
|
|
52
|
-
"@thi.ng/router": "^4.1.
|
|
53
|
-
"@thi.ng/strings": "^3.9.
|
|
54
|
-
"@thi.ng/timestamp": "^1.1.
|
|
55
|
-
"@thi.ng/uuid": "^1.1.
|
|
42
|
+
"@thi.ng/api": "^8.12.10",
|
|
43
|
+
"@thi.ng/arrays": "^2.14.3",
|
|
44
|
+
"@thi.ng/cache": "^2.3.59",
|
|
45
|
+
"@thi.ng/checks": "^3.8.0",
|
|
46
|
+
"@thi.ng/errors": "^2.5.50",
|
|
47
|
+
"@thi.ng/file-io": "^2.2.20",
|
|
48
|
+
"@thi.ng/leaky-bucket": "^0.2.22",
|
|
49
|
+
"@thi.ng/logger": "^3.2.9",
|
|
50
|
+
"@thi.ng/mime": "^2.8.2",
|
|
51
|
+
"@thi.ng/paths": "^5.2.29",
|
|
52
|
+
"@thi.ng/router": "^4.1.51",
|
|
53
|
+
"@thi.ng/strings": "^3.9.31",
|
|
54
|
+
"@thi.ng/timestamp": "^1.1.29",
|
|
55
|
+
"@thi.ng/uuid": "^1.1.42"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^24.10.1",
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
"status": "alpha",
|
|
168
168
|
"year": 2024
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
|
|
171
171
|
}
|
package/server.js
CHANGED
|
@@ -190,7 +190,7 @@ class Server {
|
|
|
190
190
|
return isPhaseUsed ? fns : void 0;
|
|
191
191
|
};
|
|
192
192
|
const result = { ...route, handlers: {} };
|
|
193
|
-
for (
|
|
193
|
+
for (const method in route.handlers) {
|
|
194
194
|
const handler = route.handlers[method];
|
|
195
195
|
result.handlers[method] = {
|
|
196
196
|
fn: isFunction(handler) ? handler : handler.fn,
|
|
@@ -201,7 +201,7 @@ class Server {
|
|
|
201
201
|
return result;
|
|
202
202
|
}
|
|
203
203
|
addRoutes(routes) {
|
|
204
|
-
for (
|
|
204
|
+
for (const r of routes) {
|
|
205
205
|
this.logger.debug("registering route:", r.id, r.match);
|
|
206
206
|
}
|
|
207
207
|
this.router.addRoutes(routes.map(this.compileRoute.bind(this)));
|
package/utils/cookies.js
CHANGED
|
@@ -6,7 +6,7 @@ const parseCoookies = (rawCookies = "", {
|
|
|
6
6
|
const res = {};
|
|
7
7
|
let currK;
|
|
8
8
|
let currV;
|
|
9
|
-
for (
|
|
9
|
+
for (const part of rawCookies.split(";")) {
|
|
10
10
|
let [name, value] = part.split("=").map((x) => x.trim());
|
|
11
11
|
value = decodeURIComponent(value);
|
|
12
12
|
switch (name.toLowerCase()) {
|
package/utils/formdata.js
CHANGED
|
@@ -3,7 +3,7 @@ import { illegalArgs } from "@thi.ng/errors";
|
|
|
3
3
|
import { setInUnsafe, updateInUnsafe } from "@thi.ng/paths";
|
|
4
4
|
const parseSearchParams = (params) => {
|
|
5
5
|
const acc = {};
|
|
6
|
-
for (
|
|
6
|
+
for (const [k, v] of params) {
|
|
7
7
|
if (k.includes("[")) return parseObjectVal(acc, k, v);
|
|
8
8
|
if (!isProtoPath(k)) acc[k] = v;
|
|
9
9
|
}
|