@thi.ng/server 0.12.18 → 0.12.20

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 210 standalone projects, maintained as part
10
+ > This is one of 212 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
  >
@@ -1,7 +1,7 @@
1
1
  import { kebab } from "@thi.ng/strings";
2
2
  const cacheControl = (opts = {}) => {
3
3
  const acc = [];
4
- for (let [k, v] of Object.entries(opts)) {
4
+ for (const [k, v] of Object.entries(opts)) {
5
5
  switch (k) {
6
6
  case "maxAge":
7
7
  acc.push("max-age=" + v);
@@ -1,6 +1,6 @@
1
1
  const injectHeaders = (headers) => ({
2
2
  pre: (ctx) => {
3
- for (let header of Object.entries(headers)) {
3
+ for (const header of Object.entries(headers)) {
4
4
  ctx.res.appendHeader(...header);
5
5
  }
6
6
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/server",
3
- "version": "0.12.18",
3
+ "version": "0.12.20",
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.9",
43
- "@thi.ng/arrays": "^2.14.2",
44
- "@thi.ng/cache": "^2.3.58",
45
- "@thi.ng/checks": "^3.7.25",
46
- "@thi.ng/errors": "^2.5.49",
47
- "@thi.ng/file-io": "^2.2.19",
48
- "@thi.ng/leaky-bucket": "^0.2.21",
49
- "@thi.ng/logger": "^3.2.8",
50
- "@thi.ng/mime": "^2.8.1",
51
- "@thi.ng/paths": "^5.2.28",
52
- "@thi.ng/router": "^4.1.50",
53
- "@thi.ng/strings": "^3.9.30",
54
- "@thi.ng/timestamp": "^1.1.28",
55
- "@thi.ng/uuid": "^1.1.41"
42
+ "@thi.ng/api": "^8.12.11",
43
+ "@thi.ng/arrays": "^2.14.4",
44
+ "@thi.ng/cache": "^2.3.60",
45
+ "@thi.ng/checks": "^3.8.1",
46
+ "@thi.ng/errors": "^2.6.0",
47
+ "@thi.ng/file-io": "^2.2.21",
48
+ "@thi.ng/leaky-bucket": "^0.2.23",
49
+ "@thi.ng/logger": "^3.2.10",
50
+ "@thi.ng/mime": "^2.8.3",
51
+ "@thi.ng/paths": "^5.2.30",
52
+ "@thi.ng/router": "^4.1.52",
53
+ "@thi.ng/strings": "^3.9.32",
54
+ "@thi.ng/timestamp": "^1.1.30",
55
+ "@thi.ng/uuid": "^1.1.43"
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": "fdca77cabf47dd23a9ab17a5ca13e3060075c12c\n"
170
+ "gitHead": "e7a21b9d2a188fa04d4c893d8531c40fbc0f4c06\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 (let method in route.handlers) {
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 (let r of routes) {
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 (let part of rawCookies.split(";")) {
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 (let [k, v] of params) {
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
  }