@ladjs/web 21.0.28 → 21.1.1
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/index.js +9 -5
- package/package.json +9 -9
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const conditional = require('koa-conditional-get');
|
|
|
23
23
|
const cors = require('kcors');
|
|
24
24
|
const cryptoRandomString = require('crypto-random-string');
|
|
25
25
|
const errorHandler = require('koa-better-error-handler');
|
|
26
|
-
const etag = require('koa
|
|
26
|
+
const etag = require('@koa/etag');
|
|
27
27
|
const favicon = require('koa-favicon');
|
|
28
28
|
const flash = require('koa-better-flash');
|
|
29
29
|
const helmet = require('koa-helmet');
|
|
@@ -95,6 +95,9 @@ class Web {
|
|
|
95
95
|
sessionKeys: process.env.SESSION_KEYS
|
|
96
96
|
? process.env.SESSION_KEYS.split(',')
|
|
97
97
|
: ['lad'],
|
|
98
|
+
prettyPrintedJSON: process.env.PRETTY_PRINTED_JSON
|
|
99
|
+
? Boolean(process.env.PRETTY_PRINTED_JSON)
|
|
100
|
+
: false,
|
|
98
101
|
cookiesKey: process.env.COOKIES_KEY || 'lad.sid',
|
|
99
102
|
favicon: {
|
|
100
103
|
path: path.resolve('./assets/img/favicon.ico'),
|
|
@@ -285,6 +288,9 @@ class Web {
|
|
|
285
288
|
return next();
|
|
286
289
|
});
|
|
287
290
|
|
|
291
|
+
// compress/gzip
|
|
292
|
+
if (this.config.compress) app.use(compress(this.config.compress));
|
|
293
|
+
|
|
288
294
|
// conditional-get
|
|
289
295
|
app.use(conditional());
|
|
290
296
|
|
|
@@ -294,9 +300,6 @@ class Web {
|
|
|
294
300
|
// cors
|
|
295
301
|
if (this.config.cors) app.use(cors(this.config.cors));
|
|
296
302
|
|
|
297
|
-
// compress/gzip
|
|
298
|
-
if (this.config.compress) app.use(compress(this.config.compress));
|
|
299
|
-
|
|
300
303
|
// cache support
|
|
301
304
|
if (this.config.koaCash) app.use(koaCash(this.config.koaCash));
|
|
302
305
|
|
|
@@ -376,7 +379,8 @@ class Web {
|
|
|
376
379
|
app.use(bodyParser());
|
|
377
380
|
|
|
378
381
|
// pretty-printed json responses
|
|
379
|
-
|
|
382
|
+
// (default unless in development/test environment)
|
|
383
|
+
app.use(json({ pretty: this.config.prettyPrintedJSON, param: 'pretty' }));
|
|
380
384
|
|
|
381
385
|
// method override
|
|
382
386
|
// (e.g. `<input type="hidden" name="_method" value="PUT" />`)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ladjs/web",
|
|
3
3
|
"description": "Web server for Lad",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.1.1",
|
|
5
5
|
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ladjs/web/issues",
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@koa/etag": "^5.0.2",
|
|
14
15
|
"@koa/router": "^13.1.1",
|
|
15
|
-
"@ladjs/i18n": "^
|
|
16
|
+
"@ladjs/i18n": "^10.0.0",
|
|
16
17
|
"@ladjs/koa-better-static": "^3.0.0",
|
|
17
18
|
"@ladjs/koa-cache-responses": "^1.0.0",
|
|
18
19
|
"@ladjs/koa-isajax": "^2.0.0",
|
|
@@ -30,10 +31,10 @@
|
|
|
30
31
|
"express-request-id": "1.4.1",
|
|
31
32
|
"is-string-and-not-blank": "^0.0.2",
|
|
32
33
|
"kcors": "^2.2.2",
|
|
33
|
-
"koa": "
|
|
34
|
+
"koa": "3.1.1",
|
|
34
35
|
"koa-404-handler": "^0.1.0",
|
|
35
36
|
"koa-basic-auth": "^4.0.0",
|
|
36
|
-
"koa-better-error-handler": "^
|
|
37
|
+
"koa-better-error-handler": "^12.0.0",
|
|
37
38
|
"koa-better-flash": "^0.0.4",
|
|
38
39
|
"koa-better-timeout": "^0.0.6",
|
|
39
40
|
"koa-bodyparser": "^4.4.1",
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
"koa-compress": "^5.1.1",
|
|
42
43
|
"koa-conditional-get": "^3.0.0",
|
|
43
44
|
"koa-connect": "^2.1.0",
|
|
44
|
-
"koa-etag": "^4.0.0",
|
|
45
45
|
"koa-favicon": "^2.1.0",
|
|
46
46
|
"koa-generic-session": "^2.3.1",
|
|
47
47
|
"koa-helmet": "5",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
54
|
"ms": "^2.1.3",
|
|
55
55
|
"request-received": "^0.0.3",
|
|
56
|
-
"response-time": "^2.3.
|
|
56
|
+
"response-time": "^2.3.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@commitlint/cli": "^19.8.1",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"eslint-config-xo-lass": "^2.0.1",
|
|
65
65
|
"fixpack": "^4.0.0",
|
|
66
66
|
"husky": "^9.1.7",
|
|
67
|
-
"ioredis": "^5.
|
|
68
|
-
"ioredis-mock": "^8.
|
|
67
|
+
"ioredis": "^5.8.2",
|
|
68
|
+
"ioredis-mock": "^8.13.1",
|
|
69
69
|
"lint-staged": "^15.4.3",
|
|
70
70
|
"nyc": "^15.1.0",
|
|
71
71
|
"pug": "^3.0.3",
|
|
72
72
|
"remark-cli": "11",
|
|
73
73
|
"remark-preset-github": "^4.0.4",
|
|
74
|
-
"supertest": "^7.1.
|
|
74
|
+
"supertest": "^7.1.4",
|
|
75
75
|
"xo": "^0.56.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|