@elliemae/pui-cli 7.0.0-beta.2 → 7.0.0-beta.3
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/lib/server/csp.js
CHANGED
|
@@ -17,13 +17,13 @@ const sources = [
|
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
const sendFileWithCSPNonce = ({
|
|
20
|
-
|
|
20
|
+
buildPath,
|
|
21
21
|
page = 'index.html',
|
|
22
22
|
nonceRegex = /__CSP_NONCE__/g,
|
|
23
23
|
res,
|
|
24
24
|
fileSystem = fs,
|
|
25
25
|
}) => {
|
|
26
|
-
fileSystem.readFile(path.resolve(
|
|
26
|
+
fileSystem.readFile(path.resolve(buildPath, page), 'utf8', (err, html) => {
|
|
27
27
|
if (err) {
|
|
28
28
|
res.sendStatus(404);
|
|
29
29
|
} else {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
const compression = require('compression');
|
|
2
2
|
const expressStaticGzip = require('express-static-gzip');
|
|
3
3
|
const { sendFileWithCSPNonce } = require('../csp');
|
|
4
|
-
const { getPaths } = require('
|
|
4
|
+
const { getPaths } = require('../../webpack/helpers');
|
|
5
5
|
|
|
6
6
|
const paths = getPaths();
|
|
7
7
|
|
|
8
|
-
module.exports = function addProdMiddlewares(
|
|
9
|
-
|
|
10
|
-
{ buildPath = paths.buildPath, mountPath = paths.mountPath },
|
|
11
|
-
) {
|
|
8
|
+
module.exports = function addProdMiddlewares(app, options = {}) {
|
|
9
|
+
const { buildPath = paths.buildPath, mountPath = paths.mountPath } = options;
|
|
12
10
|
// compression middleware compresses your server responses which makes them
|
|
13
11
|
// smaller (applies also to assets). You can read more about that technique
|
|
14
12
|
// and other good practices on official Express.js docs http://mxs.is/googmy
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const express = require('express');
|
|
2
2
|
const cors = require('cors');
|
|
3
3
|
const expressPinoLogger = require('express-pino-logger');
|
|
4
|
-
const { csp } = require('
|
|
4
|
+
const { csp } = require('../csp');
|
|
5
5
|
const addProdMiddlewares = require('./addProdMiddlewares');
|
|
6
6
|
const addDevMiddlewares = require('./addDevMiddlewares');
|
|
7
7
|
const webpackConfig = require('../../webpack/webpack.dev.babel');
|