@plone/volto 16.15.0 → 16.16.0

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/.changelog.draft CHANGED
@@ -1,24 +1,6 @@
1
- ## 16.15.0 (2023-03-08)
1
+ ## 16.16.0 (2023-03-09)
2
2
 
3
3
  ### Feature
4
4
 
5
- - Improvements to the dev API proxy:
6
- - Prefer RAZZLE_INTERNAL_API_PATH over RAZZLE_API_PATH as the target of the proxy.
7
- The target of the API proxy is now always logged on startup, even in production mode.
8
- - Support proxying to a backend served over https. For this configuration it
9
- might be necessary to set RAZZLE_DEV_PROXY_INSECURE=1 if the backend
10
- certificate can't be verified.
11
-
12
- [davisagli] [#4434](https://github.com/plone/volto/issues/4434)
13
-
14
- ### Bugfix
15
-
16
- - fix: newsitem and event views wrapper classNames @nzambello [#4443](https://github.com/plone/volto/issues/4443)
17
- - Fix weird GHA failure on config option not supported @sneridagh [#4466](https://github.com/plone/volto/issues/4466)
18
- - Fix history view dropdown for first entry, showing 'Revert to this version option' always @sneridagh [#4471](https://github.com/plone/volto/issues/4471)
19
- - Fix order of row of long table in edit and view mode @iFlameing [#4473](https://github.com/plone/volto/issues/4473)
20
-
21
- ### Documentation
22
-
23
- - Complete teaser docs, add new section in `Blocks`: `Core Blocks developers notes` @sneridagh [#4461](https://github.com/plone/volto/issues/4461)
5
+ - - Add directive to cache stable resources in browser or intermediate server for 365 days by default directly in the SSR Express server, static resource that could change after a new deployment for 1 minute. @mamico [#2216](https://github.com/plone/volto/issues/2216)
24
6
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,13 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.16.0 (2023-03-09)
12
+
13
+ ### Feature
14
+
15
+ - - Add directive to cache stable resources in browser or intermediate server for 365 days by default directly in the SSR Express server, static resource that could change after a new deployment for 1 minute. @mamico [#2216](https://github.com/plone/volto/issues/2216)
16
+
17
+
11
18
  ## 16.15.0 (2023-03-08)
12
19
 
13
20
  ### Feature
@@ -1087,8 +1094,6 @@ See https://6.dev-docs.plone.org/volto/upgrade-guide/index.html for more informa
1087
1094
 
1088
1095
  ## 16.0.0-alpha.34 (2022-09-17)
1089
1096
 
1090
- ### Breaking
1091
-
1092
1097
  ### Feature
1093
1098
 
1094
1099
  - Added new components `Aliases` for aliases control in Volto. Alias management in both controlpanel and object view. @andreiggr @avoinea
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.15.0",
12
+ "version": "16.16.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.15.0",
3
+ "version": "16.16.0",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -2,6 +2,7 @@ import imagesMiddleware from '@plone/volto/express-middleware/images';
2
2
  import filesMiddleware from '@plone/volto/express-middleware/files';
3
3
  import robotstxtMiddleware from '@plone/volto/express-middleware/robotstxt';
4
4
  import sitemapMiddleware from '@plone/volto/express-middleware/sitemap';
5
+ import staticsMiddleware from '@plone/volto/express-middleware/static';
5
6
  import devProxyMiddleware from '@plone/volto/express-middleware/devproxy';
6
7
 
7
8
  const settings = {
@@ -11,10 +12,28 @@ const settings = {
11
12
  imagesMiddleware(),
12
13
  robotstxtMiddleware(),
13
14
  sitemapMiddleware(),
15
+ staticsMiddleware(),
14
16
  ],
15
17
  criticalCssPath: 'public/critical.css',
16
18
  readCriticalCss: null, // so it will be defaultReadCriticalCss
17
19
  extractScripts: { errorPages: false },
20
+ staticFiles: [
21
+ {
22
+ id: 'root_static',
23
+ match: /^\/static\/.*/,
24
+ headers: {
25
+ // stable resources never change. 31536000 seconds == 365 days
26
+ 'Cache-Control': 'public, max-age=31536000',
27
+ },
28
+ },
29
+ {
30
+ id: 'all',
31
+ match: /.*/,
32
+ headers: {
33
+ 'Cache-Control': 'public, max-age=60',
34
+ },
35
+ },
36
+ ],
18
37
  };
19
38
 
20
39
  export default settings;
@@ -0,0 +1,32 @@
1
+ import express from 'express';
2
+ import path from 'path';
3
+ import config from '@plone/volto/registry';
4
+
5
+ const staticMiddleware = express.static(
6
+ process.env.BUILD_DIR
7
+ ? path.join(process.env.BUILD_DIR, 'public')
8
+ : process.env.RAZZLE_PUBLIC_DIR,
9
+ {
10
+ setHeaders: function (res, path) {
11
+ const pathLib = require('path');
12
+ const base = pathLib.resolve(process.env.RAZZLE_PUBLIC_DIR);
13
+ const relpath = path.substr(base.length);
14
+ config.settings.serverConfig.staticFiles.some((elem) => {
15
+ if (relpath.match(elem.match)) {
16
+ for (const name in elem.headers) {
17
+ res.setHeader(name, elem.headers[name] || 'undefined');
18
+ }
19
+ return true;
20
+ }
21
+ return false;
22
+ });
23
+ },
24
+ },
25
+ );
26
+
27
+ export default function () {
28
+ const middleware = express.Router();
29
+ middleware.all('*', staticMiddleware);
30
+ middleware.id = 'staticResourcesProcessor';
31
+ return middleware;
32
+ }
package/src/server.jsx CHANGED
@@ -59,13 +59,6 @@ const supported = new locale.Locales(keys(languages), 'en');
59
59
 
60
60
  const server = express()
61
61
  .disable('x-powered-by')
62
- .use(
63
- express.static(
64
- process.env.BUILD_DIR
65
- ? path.join(process.env.BUILD_DIR, 'public')
66
- : process.env.RAZZLE_PUBLIC_DIR,
67
- ),
68
- )
69
62
  .head('/*', function (req, res) {
70
63
  // Support for HEAD requests. Required by start-test utility in CI.
71
64
  res.send('');