@thi.ng/server 0.12.8 → 0.12.13

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.
Files changed (2) hide show
  1. package/package.json +170 -170
  2. package/CHANGELOG.md +0 -186
package/package.json CHANGED
@@ -1,171 +1,171 @@
1
1
  {
2
- "name": "@thi.ng/server",
3
- "version": "0.12.8",
4
- "description": "Minimal HTTP server with declarative routing, static file serving and freely extensible via pre/post interceptors",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
12
- },
13
- "homepage": "https://thi.ng/server",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- },
23
- {
24
- "type": "liberapay",
25
- "url": "https://liberapay.com/thi.ng"
26
- }
27
- ],
28
- "author": "Karsten Schmidt (https://thi.ng)",
29
- "license": "Apache-2.0",
30
- "scripts": {
31
- "build": "yarn build:esbuild && yarn build:decl",
32
- "build:decl": "tsc --declaration --emitDeclarationOnly",
33
- "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
34
- "clean": "bun ../../tools/src/clean-package.ts",
35
- "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
36
- "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
37
- "pub": "yarn npm publish --access public",
38
- "test": "bun test",
39
- "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
- },
41
- "dependencies": {
42
- "@thi.ng/api": "^8.12.2",
43
- "@thi.ng/arrays": "^2.13.11",
44
- "@thi.ng/cache": "^2.3.50",
45
- "@thi.ng/checks": "^3.7.18",
46
- "@thi.ng/errors": "^2.5.42",
47
- "@thi.ng/file-io": "^2.2.11",
48
- "@thi.ng/leaky-bucket": "^0.2.14",
49
- "@thi.ng/logger": "^3.2.1",
50
- "@thi.ng/mime": "^2.7.18",
51
- "@thi.ng/paths": "^5.2.21",
52
- "@thi.ng/router": "^4.1.41",
53
- "@thi.ng/strings": "^3.9.22",
54
- "@thi.ng/timestamp": "^1.1.21",
55
- "@thi.ng/uuid": "^1.1.33"
56
- },
57
- "devDependencies": {
58
- "@types/node": "^24.3.0",
59
- "esbuild": "^0.25.9",
60
- "typedoc": "^0.28.12",
61
- "typescript": "^5.9.2"
62
- },
63
- "keywords": [
64
- "cookie",
65
- "compression",
66
- "file",
67
- "formdata",
68
- "headers",
69
- "http",
70
- "https",
71
- "interceptors",
72
- "logger",
73
- "multipart",
74
- "nodejs",
75
- "querystring",
76
- "security",
77
- "server",
78
- "session",
79
- "typescript"
80
- ],
81
- "publishConfig": {
82
- "access": "public"
83
- },
84
- "browser": {
85
- "process": false,
86
- "setTimeout": false
87
- },
88
- "engines": {
89
- "node": ">=18"
90
- },
91
- "files": [
92
- "./*.js",
93
- "./*.d.ts",
94
- "interceptors",
95
- "session",
96
- "utils"
97
- ],
98
- "exports": {
99
- ".": {
100
- "default": "./index.js"
101
- },
102
- "./api": {
103
- "default": "./api.js"
104
- },
105
- "./interceptors/auth-route": {
106
- "default": "./interceptors/auth-route.js"
107
- },
108
- "./interceptors/cache-control": {
109
- "default": "./interceptors/cache-control.js"
110
- },
111
- "./interceptors/inject-headers": {
112
- "default": "./interceptors/inject-headers.js"
113
- },
114
- "./interceptors/logging": {
115
- "default": "./interceptors/logging.js"
116
- },
117
- "./interceptors/measure": {
118
- "default": "./interceptors/measure.js"
119
- },
120
- "./interceptors/rate-limit": {
121
- "default": "./interceptors/rate-limit.js"
122
- },
123
- "./interceptors/referrer-policy": {
124
- "default": "./interceptors/referrer-policy.js"
125
- },
126
- "./interceptors/reject-useragent": {
127
- "default": "./interceptors/reject-useragent.js"
128
- },
129
- "./interceptors/strict-transport": {
130
- "default": "./interceptors/strict-transport.js"
131
- },
132
- "./interceptors/x-origin-opener": {
133
- "default": "./interceptors/x-origin-opener.js"
134
- },
135
- "./interceptors/x-origin-resource": {
136
- "default": "./interceptors/x-origin-resource.js"
137
- },
138
- "./server": {
139
- "default": "./server.js"
140
- },
141
- "./session/memory": {
142
- "default": "./session/memory.js"
143
- },
144
- "./session/session": {
145
- "default": "./session/session.js"
146
- },
147
- "./static": {
148
- "default": "./static.js"
149
- },
150
- "./utils/cache": {
151
- "default": "./utils/cache.js"
152
- },
153
- "./utils/cookies": {
154
- "default": "./utils/cookies.js"
155
- },
156
- "./utils/formdata": {
157
- "default": "./utils/formdata.js"
158
- },
159
- "./utils/host": {
160
- "default": "./utils/host.js"
161
- },
162
- "./utils/multipart": {
163
- "default": "./utils/multipart.js"
164
- }
165
- },
166
- "thi.ng": {
167
- "status": "alpha",
168
- "year": 2024
169
- },
170
- "gitHead": "fbf4b46ba8a5ecff8c5423f4c2d158d208d20fc8\n"
171
- }
2
+ "name": "@thi.ng/server",
3
+ "version": "0.12.13",
4
+ "description": "Minimal HTTP server with declarative routing, static file serving and freely extensible via pre/post interceptors",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://thi.ng/server",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
18
+ },
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ },
23
+ {
24
+ "type": "liberapay",
25
+ "url": "https://liberapay.com/thi.ng"
26
+ }
27
+ ],
28
+ "author": "Karsten Schmidt (https://thi.ng)",
29
+ "license": "Apache-2.0",
30
+ "scripts": {
31
+ "build": "yarn build:esbuild && yarn build:decl",
32
+ "build:decl": "tsc --declaration --emitDeclarationOnly",
33
+ "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
34
+ "clean": "bun ../../tools/src/clean-package.ts",
35
+ "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
36
+ "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
37
+ "pub": "npm publish --access public",
38
+ "test": "bun test",
39
+ "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
+ },
41
+ "dependencies": {
42
+ "@thi.ng/api": "^8.12.7",
43
+ "@thi.ng/arrays": "^2.13.16",
44
+ "@thi.ng/cache": "^2.3.55",
45
+ "@thi.ng/checks": "^3.7.23",
46
+ "@thi.ng/errors": "^2.5.47",
47
+ "@thi.ng/file-io": "^2.2.16",
48
+ "@thi.ng/leaky-bucket": "^0.2.19",
49
+ "@thi.ng/logger": "^3.2.6",
50
+ "@thi.ng/mime": "^2.7.23",
51
+ "@thi.ng/paths": "^5.2.26",
52
+ "@thi.ng/router": "^4.1.46",
53
+ "@thi.ng/strings": "^3.9.27",
54
+ "@thi.ng/timestamp": "^1.1.26",
55
+ "@thi.ng/uuid": "^1.1.38"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^24.9.1",
59
+ "esbuild": "^0.25.11",
60
+ "typedoc": "^0.28.14",
61
+ "typescript": "^5.9.3"
62
+ },
63
+ "keywords": [
64
+ "cookie",
65
+ "compression",
66
+ "file",
67
+ "formdata",
68
+ "headers",
69
+ "http",
70
+ "https",
71
+ "interceptors",
72
+ "logger",
73
+ "multipart",
74
+ "nodejs",
75
+ "querystring",
76
+ "security",
77
+ "server",
78
+ "session",
79
+ "typescript"
80
+ ],
81
+ "publishConfig": {
82
+ "access": "public"
83
+ },
84
+ "browser": {
85
+ "process": false,
86
+ "setTimeout": false
87
+ },
88
+ "engines": {
89
+ "node": ">=18"
90
+ },
91
+ "files": [
92
+ "./*.js",
93
+ "./*.d.ts",
94
+ "interceptors",
95
+ "session",
96
+ "utils"
97
+ ],
98
+ "exports": {
99
+ ".": {
100
+ "default": "./index.js"
101
+ },
102
+ "./api": {
103
+ "default": "./api.js"
104
+ },
105
+ "./interceptors/auth-route": {
106
+ "default": "./interceptors/auth-route.js"
107
+ },
108
+ "./interceptors/cache-control": {
109
+ "default": "./interceptors/cache-control.js"
110
+ },
111
+ "./interceptors/inject-headers": {
112
+ "default": "./interceptors/inject-headers.js"
113
+ },
114
+ "./interceptors/logging": {
115
+ "default": "./interceptors/logging.js"
116
+ },
117
+ "./interceptors/measure": {
118
+ "default": "./interceptors/measure.js"
119
+ },
120
+ "./interceptors/rate-limit": {
121
+ "default": "./interceptors/rate-limit.js"
122
+ },
123
+ "./interceptors/referrer-policy": {
124
+ "default": "./interceptors/referrer-policy.js"
125
+ },
126
+ "./interceptors/reject-useragent": {
127
+ "default": "./interceptors/reject-useragent.js"
128
+ },
129
+ "./interceptors/strict-transport": {
130
+ "default": "./interceptors/strict-transport.js"
131
+ },
132
+ "./interceptors/x-origin-opener": {
133
+ "default": "./interceptors/x-origin-opener.js"
134
+ },
135
+ "./interceptors/x-origin-resource": {
136
+ "default": "./interceptors/x-origin-resource.js"
137
+ },
138
+ "./server": {
139
+ "default": "./server.js"
140
+ },
141
+ "./session/memory": {
142
+ "default": "./session/memory.js"
143
+ },
144
+ "./session/session": {
145
+ "default": "./session/session.js"
146
+ },
147
+ "./static": {
148
+ "default": "./static.js"
149
+ },
150
+ "./utils/cache": {
151
+ "default": "./utils/cache.js"
152
+ },
153
+ "./utils/cookies": {
154
+ "default": "./utils/cookies.js"
155
+ },
156
+ "./utils/formdata": {
157
+ "default": "./utils/formdata.js"
158
+ },
159
+ "./utils/host": {
160
+ "default": "./utils/host.js"
161
+ },
162
+ "./utils/multipart": {
163
+ "default": "./utils/multipart.js"
164
+ }
165
+ },
166
+ "thi.ng": {
167
+ "status": "alpha",
168
+ "year": 2024
169
+ },
170
+ "gitHead": "d977f819bcafdcb2b24c45f8d01a167fe29fc85a\n"
171
+ }
package/CHANGELOG.md DELETED
@@ -1,186 +0,0 @@
1
- # Change Log
2
-
3
- - **Last updated**: 2025-09-25T11:10:32Z
4
- - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
-
6
- All notable changes to this project will be documented in this file.
7
- Only versions published since **2022-01-01** are listed here.
8
- Please consult the Git history for older version information.
9
- See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
10
-
11
- **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
- and/or version bumps of transitive dependencies.
13
-
14
- ### [0.12.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.12.6) (2025-09-25)
15
-
16
- #### 🩹 Bug fixes
17
-
18
- - update cacheControl() ([21b48a4](https://github.com/thi-ng/umbrella/commit/21b48a4))
19
- - don't set field if its value is false
20
-
21
- ### [0.12.5](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.12.5) (2025-09-01)
22
-
23
- #### ♻️ Refactoring
24
-
25
- - fix type import ([8e90657](https://github.com/thi-ng/umbrella/commit/8e90657))
26
-
27
- ## [0.12.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.12.0) (2025-08-04)
28
-
29
- #### 🚀 Features
30
-
31
- - add `SessionOpts.onInvalid` callback ([83c15ee](https://github.com/thi-ng/umbrella/commit/83c15ee))
32
-
33
- ## [0.11.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.11.0) (2025-06-05)
34
-
35
- #### 🚀 Features
36
-
37
- - force expire session cookie if invalid session ([ac6c208](https://github.com/thi-ng/umbrella/commit/ac6c208))
38
-
39
- ## [0.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.10.0) (2025-04-16)
40
-
41
- #### 🚀 Features
42
-
43
- - add `#` in URL safety check, update `RequestCtx` ([f0a7025](https://github.com/thi-ng/umbrella/commit/f0a7025))
44
- - respond with HTTP 400 if request URL contains `#`
45
- - this stops maliciously contructed requests via HTTP `request-target`
46
- - add docs
47
-
48
- ## [0.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.9.0) (2025-03-22)
49
-
50
- #### 🚀 Features
51
-
52
- - update static file serving ([e3ee3d6](https://github.com/thi-ng/umbrella/commit/e3ee3d6))
53
- - update `StaticOpts` to support multiple `filters` & individual `headers` per file
54
- - update `StaticOpts.prefix` type
55
- - consolidate GET & HEAD handlers
56
- - update `__fileHeaders()` to perform more checks and inject headers
57
- - update `etagFileTimeModified()` to return base36 timestamp
58
- - add `pathFilterASCII()` and `pathMaxLength()` filter predicates
59
- - use `pathFilterASCII()` as default filter
60
-
61
- ## [0.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.8.0) (2025-03-13)
62
-
63
- #### 🚀 Features
64
-
65
- - add method adapter, update `RequestCtx` ([360abda](https://github.com/thi-ng/umbrella/commit/360abda))
66
- - add `ServerOpts.method` to allow for method conversion
67
- - add `rejectUserAgents()` interceptor ([de0c373](https://github.com/thi-ng/umbrella/commit/de0c373))
68
- - add UA presets for AI bots & scrapers
69
-
70
- ## [0.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.7.0) (2025-03-09)
71
-
72
- #### 🚀 Features
73
-
74
- - update RateLimiter to use leaky buckets ([f342fde](https://github.com/thi-ng/umbrella/commit/f342fde))
75
- - update `RateLimterOpts`
76
- - update/simplify `RateLimiter` interceptor
77
- - update deps
78
-
79
- ## [0.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.6.0) (2025-02-21)
80
-
81
- #### 🚀 Features
82
-
83
- - update `sessionInterceptor()` cookie signing/handling ([bdd4d66](https://github.com/thi-ng/umbrella/commit/bdd4d66))
84
- - update `SessionInterceptor.newSession()`
85
- - pre-compute session metadata (HMAC & cookie values), store in WeakMap
86
- - update `.withSession()`
87
- - update `.validateSession()` to use cached signature
88
- - update tests
89
- - add/update `ServerOpts` ([23b5321](https://github.com/thi-ng/umbrella/commit/23b5321))
90
-
91
- ## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.5.0) (2025-02-19)
92
-
93
- #### 🚀 Features
94
-
95
- - update interceptor handling ([9cdb8b8](https://github.com/thi-ng/umbrella/commit/9cdb8b8))
96
- - update post-interceptor execution logic & return values
97
- - update `Server.runHandler()`, `Server.compileRoute()`
98
- - update `logResponse()`, `measure()` interceptors
99
-
100
- #### ♻️ Refactoring
101
-
102
- - rename `serverSession()` => `sessionInterceptor()` ([2ada168](https://github.com/thi-ng/umbrella/commit/2ada168))
103
- - add docs
104
-
105
- ## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.4.0) (2025-02-10)
106
-
107
- #### 🚀 Features
108
-
109
- - update ServerSession & interceptor ([71d26bb](https://github.com/thi-ng/umbrella/commit/71d26bb))
110
- - add `ServerSession.ip`
111
- - update `SessionInterceptor` to validate stored IP addr
112
- - rename `.delete()` => `.deleteSession()`
113
- - add `.replaceSession()`
114
- - remove obsolete `FlashMsg` (for now)
115
- - update ServerResponse, update host matching ([25a07f3](https://github.com/thi-ng/umbrella/commit/25a07f3))
116
- - update `isMatchingHost()`
117
- - add `ServerResponse.rateLimit()` and `.noResponse()`
118
- - update tests
119
- - update SessionInterceptor to create signed cookie ([d240107](https://github.com/thi-ng/umbrella/commit/d240107))
120
- - add `SessionOpts.secret`
121
- - sign session ID with salt & SHA256
122
- - add validateSession()
123
- - update pre() interceptor
124
- - add `rateLimiter()` interceptor ([245cc9d](https://github.com/thi-ng/umbrella/commit/245cc9d))
125
- - add `measure()` interceptor ([4702e84](https://github.com/thi-ng/umbrella/commit/4702e84))
126
- - refactor logRequest/Response() interceptors
127
-
128
- #### ⏱ Performance improvements
129
-
130
- - update Server 404 & OPTIONS handling, remove method override ([71307af](https://github.com/thi-ng/umbrella/commit/71307af))
131
- - process 404 asap (without full request ctx)
132
- - process default HTTP OPTIONS handler asap
133
- - in both cases no interceptors will be run anymore
134
-
135
- ## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.3.0) (2025-02-02)
136
-
137
- #### 🚀 Features
138
-
139
- - add more HTTP error response methods ([5731ff3](https://github.com/thi-ng/umbrella/commit/5731ff3))
140
- - add ServerResponse, IPv6 support ([22f64c5](https://github.com/thi-ng/umbrella/commit/22f64c5))
141
-
142
- ## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.2.0) (2025-01-30)
143
-
144
- #### 🚀 Features
145
-
146
- - add generics, various other updates ([a340f65](https://github.com/thi-ng/umbrella/commit/a340f65))
147
- - add generics to most main types/interfaces
148
- - refactor `SessionInterceptor` as class w/ pluggable storage
149
- - add `ISessionStore` and `InMemorySessionStore` impl
150
- - update ServerOpts to allow augmenting request context object
151
- - add default HTTP OPTIONS handler
152
- - update Server cookie parsing
153
- - add StaticOpts.auth flag
154
- - update logRequest() interceptor
155
- - update pkg exports
156
- - update tests
157
-
158
- ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/server@0.1.0) (2025-01-29)
159
-
160
- #### 🚀 Features
161
-
162
- - migrate/import as new pkg ([61035bb](https://github.com/thi-ng/umbrella/commit/61035bb))
163
- - re-import various security header interceptors ([036b9b2](https://github.com/thi-ng/umbrella/commit/036b9b2))
164
- - add interceptors:
165
- - `crossOriginOpenerPolicy()`
166
- - `crossOriginResourcePolicy()`
167
- - `referrerPolicy()`
168
- - `strictTransportSecurity()`
169
- - add/update tests
170
- - update sendFile(), staticFiles() and compression handling ([9f4d25a](https://github.com/thi-ng/umbrella/commit/9f4d25a))
171
- - add support for brotli, gzip, deflate
172
- - refactor sendFile() internals
173
- - disable compression by default
174
- - import refactored cacheControl() interceptor ([4eff206](https://github.com/thi-ng/umbrella/commit/4eff206))
175
- - update pkg deps & exports
176
- - update tests
177
- - re-add etag support/handlers ([13fb75e](https://github.com/thi-ng/umbrella/commit/13fb75e))
178
- - add `StaticOpts.etag`
179
- - update `staticFiles()` HEAD/GET handlers
180
- - add `Server.unmodified()`
181
- - add `etagFileTimeModified()`
182
- - add `etagFileHash()`
183
- - add `isUnmodified()` helper
184
- - remove "content-length" header from HEAD handler
185
- - update tests
186
- - add `server()` factory function (syntax sugar) ([ee22ea1](https://github.com/thi-ng/umbrella/commit/ee22ea1))