@dwp/govuk-casa 8.16.3 → 8.16.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/dist/middleware/pre.js +1 -2
- package/dist/middleware/pre.js.map +1 -1
- package/dist/routes/static.d.ts +12 -3
- package/dist/routes/static.js +7 -5
- package/dist/routes/static.js.map +1 -1
- package/package.json +15 -15
- package/src/middleware/pre.js +1 -2
- package/src/routes/static.js +10 -5
package/dist/middleware/pre.js
CHANGED
|
@@ -52,8 +52,7 @@ exports.default = ({ helmetConfigurator = (config) => config } = {}) => [
|
|
|
52
52
|
// The `no-store` setting is to specifically disable the bfcache and prevent
|
|
53
53
|
// possible leakage of information.
|
|
54
54
|
(req, res, next) => {
|
|
55
|
-
res.set("cache-control", "no-
|
|
56
|
-
res.set("pragma", "no-cache");
|
|
55
|
+
res.set("cache-control", "no-store");
|
|
57
56
|
res.set("expires", 0);
|
|
58
57
|
res.set("x-robots-tag", "noindex, nofollow");
|
|
59
58
|
next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre.js","sourceRoot":"","sources":["../../src/middleware/pre.js"],"names":[],"mappings":";;;;;AAAA,mCAAqC;AACrC,oDAA4B;AAE5B;;;GAGG;AAEH,MAAM,SAAS,GAAG,wBAAwB,CAAC;AAC3C,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,kBAAkB,GAAG,+BAA+B,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG;IAC5B,OAAO,UAAU,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,kBAAe,CAAC,EAAE,kBAAkB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACnE,qCAAqC;IAC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S;oBACT,mBAAmB;oBACnB,UAAU;oBACV,yBAAyB;oBACzB,yBAAyB;oBACzB,2BAA2B;iBAC5B;gBACD,aAAa,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,CAAC;gBACrE,WAAW,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;gBACnC,iBAAiB,EAAE,CAAC,QAAQ,CAAC;gBAC7B,aAAa,EAAE,CAAC,QAAQ,CAAC;gBACzB,WAAW,EAAE;oBACX,QAAQ;oBACR,8BAA8B;oBAC9B,kBAAkB;oBAClB,UAAU;oBACV,YAAY;oBACZ,uDAAuD;oBACvD,uDAAuD;oBACvD,uDAAuD;iBACxD;gBACD,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,2BAA2B,CAAC;aAC7D;SACF;QAED,wCAAwC;QACxC,8CAA8C;KAC/C,CAAC,CACH;CACF,CAAC"}
|
package/dist/routes/static.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {object} StaticOptions Options to configure static router
|
|
3
|
-
* @property {number} [maxAge=3600000] Cache TTL for all assets
|
|
3
|
+
* @property {number} [maxAge=3600000] Cache TTL for all assets. Default is
|
|
4
|
+
* `3600000`
|
|
5
|
+
* @property {string} [cacheControl=private] Cache control headers. Default is
|
|
6
|
+
* `private`
|
|
4
7
|
*/
|
|
5
8
|
/**
|
|
6
9
|
* Create a router for serving CASA's static assets.
|
|
@@ -9,14 +12,20 @@
|
|
|
9
12
|
* @param {StaticOptions} options Options
|
|
10
13
|
* @returns {MutableRouter} ExpressJS Router instance
|
|
11
14
|
*/
|
|
12
|
-
export default function staticRouter({ maxAge }?: StaticOptions): MutableRouter;
|
|
15
|
+
export default function staticRouter({ maxAge, cacheControl, }?: StaticOptions): MutableRouter;
|
|
13
16
|
/**
|
|
14
17
|
* Options to configure static router
|
|
15
18
|
*/
|
|
16
19
|
export type StaticOptions = {
|
|
17
20
|
/**
|
|
18
|
-
* Cache TTL for all assets
|
|
21
|
+
* Cache TTL for all assets. Default is
|
|
22
|
+
* `3600000`
|
|
19
23
|
*/
|
|
20
24
|
maxAge?: number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Cache control headers. Default is
|
|
27
|
+
* `private`
|
|
28
|
+
*/
|
|
29
|
+
cacheControl?: string | undefined;
|
|
21
30
|
};
|
|
22
31
|
import MutableRouter from "../lib/MutableRouter.js";
|
package/dist/routes/static.js
CHANGED
|
@@ -16,7 +16,10 @@ const { static: ExpressStatic } = express_1.default; // CommonJS
|
|
|
16
16
|
const oneDay = 86400000;
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {object} StaticOptions Options to configure static router
|
|
19
|
-
* @property {number} [maxAge=3600000] Cache TTL for all assets
|
|
19
|
+
* @property {number} [maxAge=3600000] Cache TTL for all assets. Default is
|
|
20
|
+
* `3600000`
|
|
21
|
+
* @property {string} [cacheControl=private] Cache control headers. Default is
|
|
22
|
+
* `private`
|
|
20
23
|
*/
|
|
21
24
|
/**
|
|
22
25
|
* Create a router for serving CASA's static assets.
|
|
@@ -25,7 +28,7 @@ const oneDay = 86400000;
|
|
|
25
28
|
* @param {StaticOptions} options Options
|
|
26
29
|
* @returns {MutableRouter} ExpressJS Router instance
|
|
27
30
|
*/
|
|
28
|
-
function staticRouter({ maxAge = 3600000 } = {}) {
|
|
31
|
+
function staticRouter({ maxAge = 3600000, cacheControl = "no-cache, private", } = {}) {
|
|
29
32
|
const router = new MutableRouter_js_1.default();
|
|
30
33
|
const notFoundHandler = (req, res, next) => {
|
|
31
34
|
// Fall through to a general purpose error handler
|
|
@@ -33,9 +36,8 @@ function staticRouter({ maxAge = 3600000 } = {}) {
|
|
|
33
36
|
};
|
|
34
37
|
const setHeaders = (req, res, next) => {
|
|
35
38
|
var _a;
|
|
36
|
-
res.set("cache-control",
|
|
37
|
-
res.set("
|
|
38
|
-
res.set("expires", new Date(Date.now() + oneDay).toUTCString());
|
|
39
|
+
res.set("cache-control", cacheControl);
|
|
40
|
+
res.set("expires", new Date(Date.now() + maxAge).toUTCString());
|
|
39
41
|
const { pathname } = new url_1.URL((_a = req === null || req === void 0 ? void 0 : req.originalUrl) !== null && _a !== void 0 ? _a : "", "https://placeholder.test/");
|
|
40
42
|
if (pathname.substr(-4) === ".css") {
|
|
41
43
|
// Just needed for our in-memory CSS assets
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/routes/static.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/routes/static.js"],"names":[],"mappings":";;;;;AA6BA,+BAwFC;AArHD,sDAAgC;AAChC,2BAAkC;AAClC,6BAA0B;AAC1B,+BAA+B;AAC/B,mCAAuC;AAEvC,gEAAoC;AACpC,+EAAoD;AACpD,8CAAkD;AAElD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,iBAAS,CAAC,CAAC,WAAW;AAExD,MAAM,MAAM,GAAG,QAAQ,CAAC;AAExB;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,SAAwB,YAAY,CAAC,EACnC,MAAM,GAAG,OAAO,EAChB,YAAY,GAAG,mBAAmB,GACnC,GAAG,EAAE;IACJ,MAAM,MAAM,GAAG,IAAI,0BAAa,EAAE,CAAC;IAEnC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzC,kDAAkD;QAClD,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;;QACpC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACvC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,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ACF,MAAM,CAAC,GAAG,CACR,6BAA6B,EAC7B,aAAa,CAAC,GAAG,sBAAsB,mBAAmB,EAAE,YAAY,CAAC,CAC1E,CAAC;IACF,MAAM,CAAC,GAAG,CACR,eAAe,EACf,aAAa,CAAC,GAAG,sBAAsB,eAAe,EAAE,YAAY,CAAC,CACtE,CAAC;IACF,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAE7C,MAAM,CAAC,GAAG,CAAC,2BAA2B,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAC/D,GAAG,CAAC,IAAI,CACN,OAAO,CAAC,OAAO,CACb,uBAAuB,EACvB,IAAA,0BAAe,EAAC,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,CACnC,CACF,CACF,CAAC;IACF,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CACnE,GAAG,CAAC,IAAI,CACN,UAAU,CAAC,OAAO,CAChB,uBAAuB,EACvB,IAAA,0BAAe,EAAC,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,CACnC,CACF,CACF,CAAC;IACF,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAE5C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwp/govuk-casa",
|
|
3
|
-
"version": "8.16.
|
|
3
|
+
"version": "8.16.5",
|
|
4
4
|
"description": "A framework for building GOVUK Collect-And-Submit-Applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"express-session": "1.18.1",
|
|
59
59
|
"govuk-frontend": "4.9.0",
|
|
60
60
|
"helmet": "8.0.0",
|
|
61
|
-
"i18next": "24.2.
|
|
62
|
-
"i18next-http-middleware": "3.7.
|
|
61
|
+
"i18next": "24.2.2",
|
|
62
|
+
"i18next-http-middleware": "3.7.1",
|
|
63
63
|
"js-yaml": "4.1.0",
|
|
64
64
|
"lodash": "4.17.21",
|
|
65
65
|
"luxon": "3.5.0",
|
|
@@ -69,33 +69,33 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@ckeditor/jsdoc-plugins": "43.0.1",
|
|
72
|
-
"@commitlint/config-conventional": "19.
|
|
73
|
-
"@dwp/casa-spiderplan": "4.
|
|
72
|
+
"@commitlint/config-conventional": "19.7.1",
|
|
73
|
+
"@dwp/casa-spiderplan": "4.2.0",
|
|
74
74
|
"@dwp/casa-spiderplan-a11y-plugin": "1.0.2",
|
|
75
|
-
"@dwp/casa-spiderplan-zap-plugin": "1.0.
|
|
75
|
+
"@dwp/casa-spiderplan-zap-plugin": "1.0.3",
|
|
76
76
|
"@dwp/eslint-config-base": "9.0.2",
|
|
77
77
|
"@types/express": "4.17.21",
|
|
78
|
-
"@types/node": "22.
|
|
78
|
+
"@types/node": "22.13.5",
|
|
79
79
|
"@types/nunjucks": "3.2.6",
|
|
80
80
|
"c8": "10.1.3",
|
|
81
|
-
"chai": "5.
|
|
81
|
+
"chai": "5.2.0",
|
|
82
82
|
"cheerio": "1.0.0",
|
|
83
|
-
"commitlint": "19.
|
|
83
|
+
"commitlint": "19.7.1",
|
|
84
84
|
"docdash": "2.0.2",
|
|
85
|
-
"eslint": "9.
|
|
85
|
+
"eslint": "9.21.0",
|
|
86
86
|
"eslint-plugin-import": "2.31.0",
|
|
87
|
-
"eslint-plugin-jsdoc": "50.6.
|
|
87
|
+
"eslint-plugin-jsdoc": "50.6.3",
|
|
88
88
|
"eslint-plugin-no-unsafe-regex": "1.0.0",
|
|
89
89
|
"eslint-plugin-security": "3.0.1",
|
|
90
|
-
"eslint-plugin-sonarjs": "3.0.
|
|
90
|
+
"eslint-plugin-sonarjs": "3.0.2",
|
|
91
91
|
"fast-check": "3.23.2",
|
|
92
92
|
"jsdoc": "4.0.4",
|
|
93
93
|
"jsdoc-tsimport-plugin": "1.0.5",
|
|
94
|
-
"mocha": "11.0
|
|
95
|
-
"sass": "1.
|
|
94
|
+
"mocha": "11.1.0",
|
|
95
|
+
"sass": "1.85.1",
|
|
96
96
|
"sinon": "19.0.2",
|
|
97
97
|
"sinon-chai": "4.0.0",
|
|
98
98
|
"supertest": "7.0.0",
|
|
99
|
-
"typescript": "5.7.
|
|
99
|
+
"typescript": "5.7.3"
|
|
100
100
|
}
|
|
101
101
|
}
|
package/src/middleware/pre.js
CHANGED
|
@@ -53,8 +53,7 @@ export default ({ helmetConfigurator = (config) => config } = {}) => [
|
|
|
53
53
|
// The `no-store` setting is to specifically disable the bfcache and prevent
|
|
54
54
|
// possible leakage of information.
|
|
55
55
|
(req, res, next) => {
|
|
56
|
-
res.set("cache-control", "no-
|
|
57
|
-
res.set("pragma", "no-cache");
|
|
56
|
+
res.set("cache-control", "no-store");
|
|
58
57
|
res.set("expires", 0);
|
|
59
58
|
res.set("x-robots-tag", "noindex, nofollow");
|
|
60
59
|
next();
|
package/src/routes/static.js
CHANGED
|
@@ -14,7 +14,10 @@ const oneDay = 86400000;
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @typedef {object} StaticOptions Options to configure static router
|
|
17
|
-
* @property {number} [maxAge=3600000] Cache TTL for all assets
|
|
17
|
+
* @property {number} [maxAge=3600000] Cache TTL for all assets. Default is
|
|
18
|
+
* `3600000`
|
|
19
|
+
* @property {string} [cacheControl=private] Cache control headers. Default is
|
|
20
|
+
* `private`
|
|
18
21
|
*/
|
|
19
22
|
|
|
20
23
|
/**
|
|
@@ -24,7 +27,10 @@ const oneDay = 86400000;
|
|
|
24
27
|
* @param {StaticOptions} options Options
|
|
25
28
|
* @returns {MutableRouter} ExpressJS Router instance
|
|
26
29
|
*/
|
|
27
|
-
export default function staticRouter({
|
|
30
|
+
export default function staticRouter({
|
|
31
|
+
maxAge = 3600000,
|
|
32
|
+
cacheControl = "no-cache, private",
|
|
33
|
+
} = {}) {
|
|
28
34
|
const router = new MutableRouter();
|
|
29
35
|
|
|
30
36
|
const notFoundHandler = (req, res, next) => {
|
|
@@ -33,9 +39,8 @@ export default function staticRouter({ maxAge = 3600000 } = {}) {
|
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
const setHeaders = (req, res, next) => {
|
|
36
|
-
res.set("cache-control",
|
|
37
|
-
res.set("
|
|
38
|
-
res.set("expires", new Date(Date.now() + oneDay).toUTCString());
|
|
42
|
+
res.set("cache-control", cacheControl);
|
|
43
|
+
res.set("expires", new Date(Date.now() + maxAge).toUTCString());
|
|
39
44
|
const { pathname } = new URL(
|
|
40
45
|
req?.originalUrl ?? "",
|
|
41
46
|
"https://placeholder.test/",
|