@lwrjs/core 0.15.0-alpha.39 → 0.15.0-alpha.41
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.
|
@@ -124,6 +124,9 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
124
124
|
}
|
|
125
125
|
res.type("text/html");
|
|
126
126
|
if (viewResponse.headers) {
|
|
127
|
+
if ((0, import_shared_utils.isLocalDev)()) {
|
|
128
|
+
delete viewResponse.headers["content-security-policy"];
|
|
129
|
+
}
|
|
127
130
|
res.set(viewResponse.headers);
|
|
128
131
|
}
|
|
129
132
|
if (!res.hasHeader("cache-control")) {
|
|
@@ -156,15 +159,12 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
156
159
|
if (shouldCompress) {
|
|
157
160
|
const start = performance.now();
|
|
158
161
|
let compressionMethod;
|
|
159
|
-
if (req.headers["accept-encoding"]?.includes("
|
|
160
|
-
res.setHeader("Content-Encoding", "br");
|
|
161
|
-
compressionMethod = import_zlib.brotliCompressSync;
|
|
162
|
-
} else if (req.headers["accept-encoding"]?.includes("gzip")) {
|
|
162
|
+
if (req.headers["accept-encoding"]?.includes("gzip")) {
|
|
163
163
|
compressionMethod = import_zlib.gzipSync;
|
|
164
164
|
res.setHeader("Content-Encoding", "gzip");
|
|
165
165
|
} else {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
res.setHeader("Content-Encoding", "br");
|
|
167
|
+
compressionMethod = import_zlib.brotliCompressSync;
|
|
168
168
|
}
|
|
169
169
|
const compressedView = compressionMethod(viewResponseBody);
|
|
170
170
|
const end = performance.now();
|
|
@@ -2,7 +2,7 @@ import { TextEncoder } from 'util';
|
|
|
2
2
|
import { URLSearchParams } from 'url';
|
|
3
3
|
import { descriptions, logger } from '@lwrjs/diagnostics';
|
|
4
4
|
import { getClientRoutes } from '@lwrjs/router';
|
|
5
|
-
import { decodeViewPath, extractRequestParams, getClientBootstrapConfigurationRoutes, isURL, parseRequestDepth, REQUEST_DEPTH_KEY, shortestTtl, isLambdaEnv, } from '@lwrjs/shared-utils';
|
|
5
|
+
import { decodeViewPath, extractRequestParams, getClientBootstrapConfigurationRoutes, isURL, parseRequestDepth, REQUEST_DEPTH_KEY, isLocalDev, shortestTtl, isLambdaEnv, } from '@lwrjs/shared-utils';
|
|
6
6
|
import { RequestHandlerSpan, getTracer } from '@lwrjs/instrumentation';
|
|
7
7
|
import { handleErrors } from './utils/error-handling.js';
|
|
8
8
|
import { LwrViewHandler } from '@lwrjs/view-registry';
|
|
@@ -104,6 +104,11 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
104
104
|
res.type('text/html');
|
|
105
105
|
// the default content type can be overridden if specified by the view response
|
|
106
106
|
if (viewResponse.headers) {
|
|
107
|
+
if (isLocalDev()) {
|
|
108
|
+
// Disable CSP for local dev
|
|
109
|
+
// TODO we should find a cleaner way to accomplish this but has to be here for now
|
|
110
|
+
delete viewResponse.headers['content-security-policy'];
|
|
111
|
+
}
|
|
107
112
|
res.set(viewResponse.headers);
|
|
108
113
|
}
|
|
109
114
|
// pick the shortest TTL between the view response and route object
|
|
@@ -132,6 +137,7 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
132
137
|
}
|
|
133
138
|
res.status(status);
|
|
134
139
|
// LWR@MRT 254 temporary safeguard for "dupe styles" issue causing huge base docs
|
|
140
|
+
// Re-evaluate for removal once we determine it is no longer needed: W-17201070
|
|
135
141
|
const viewResponseBody = viewResponse.body;
|
|
136
142
|
let shouldCompress, viewResponseSize;
|
|
137
143
|
if (isLambdaEnv() && typeof viewResponseBody === 'string') {
|
|
@@ -142,17 +148,14 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
|
|
|
142
148
|
if (shouldCompress) {
|
|
143
149
|
const start = performance.now();
|
|
144
150
|
let compressionMethod;
|
|
145
|
-
if (req.headers['accept-encoding']?.includes('
|
|
146
|
-
res.setHeader('Content-Encoding', 'br');
|
|
147
|
-
compressionMethod = brotliCompressSync;
|
|
148
|
-
}
|
|
149
|
-
else if (req.headers['accept-encoding']?.includes('gzip')) {
|
|
151
|
+
if (req.headers['accept-encoding']?.includes('gzip')) {
|
|
150
152
|
compressionMethod = gzipSync;
|
|
151
153
|
res.setHeader('Content-Encoding', 'gzip');
|
|
152
154
|
}
|
|
153
155
|
else {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
// Default to Brotli compression even if the header is missing.
|
|
157
|
+
res.setHeader('Content-Encoding', 'br');
|
|
158
|
+
compressionMethod = brotliCompressSync;
|
|
156
159
|
}
|
|
157
160
|
const compressedView = compressionMethod(viewResponseBody);
|
|
158
161
|
const end = performance.now();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.15.0-alpha.
|
|
7
|
+
"version": "0.15.0-alpha.41",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -43,34 +43,34 @@
|
|
|
43
43
|
"build": "tsc -b"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@lwrjs/app-service": "0.15.0-alpha.
|
|
47
|
-
"@lwrjs/asset-registry": "0.15.0-alpha.
|
|
48
|
-
"@lwrjs/asset-transformer": "0.15.0-alpha.
|
|
49
|
-
"@lwrjs/base-view-provider": "0.15.0-alpha.
|
|
50
|
-
"@lwrjs/base-view-transformer": "0.15.0-alpha.
|
|
51
|
-
"@lwrjs/client-modules": "0.15.0-alpha.
|
|
52
|
-
"@lwrjs/config": "0.15.0-alpha.
|
|
53
|
-
"@lwrjs/diagnostics": "0.15.0-alpha.
|
|
54
|
-
"@lwrjs/esbuild": "0.15.0-alpha.
|
|
55
|
-
"@lwrjs/fs-asset-provider": "0.15.0-alpha.
|
|
56
|
-
"@lwrjs/fs-watch": "0.15.0-alpha.
|
|
57
|
-
"@lwrjs/html-view-provider": "0.15.0-alpha.
|
|
58
|
-
"@lwrjs/instrumentation": "0.15.0-alpha.
|
|
59
|
-
"@lwrjs/loader": "0.15.0-alpha.
|
|
60
|
-
"@lwrjs/lwc-module-provider": "0.15.0-alpha.
|
|
61
|
-
"@lwrjs/lwc-ssr": "0.15.0-alpha.
|
|
62
|
-
"@lwrjs/markdown-view-provider": "0.15.0-alpha.
|
|
63
|
-
"@lwrjs/module-bundler": "0.15.0-alpha.
|
|
64
|
-
"@lwrjs/module-registry": "0.15.0-alpha.
|
|
65
|
-
"@lwrjs/npm-module-provider": "0.15.0-alpha.
|
|
66
|
-
"@lwrjs/nunjucks-view-provider": "0.15.0-alpha.
|
|
67
|
-
"@lwrjs/o11y": "0.15.0-alpha.
|
|
68
|
-
"@lwrjs/resource-registry": "0.15.0-alpha.
|
|
69
|
-
"@lwrjs/router": "0.15.0-alpha.
|
|
70
|
-
"@lwrjs/server": "0.15.0-alpha.
|
|
71
|
-
"@lwrjs/shared-utils": "0.15.0-alpha.
|
|
72
|
-
"@lwrjs/static": "0.15.0-alpha.
|
|
73
|
-
"@lwrjs/view-registry": "0.15.0-alpha.
|
|
46
|
+
"@lwrjs/app-service": "0.15.0-alpha.41",
|
|
47
|
+
"@lwrjs/asset-registry": "0.15.0-alpha.41",
|
|
48
|
+
"@lwrjs/asset-transformer": "0.15.0-alpha.41",
|
|
49
|
+
"@lwrjs/base-view-provider": "0.15.0-alpha.41",
|
|
50
|
+
"@lwrjs/base-view-transformer": "0.15.0-alpha.41",
|
|
51
|
+
"@lwrjs/client-modules": "0.15.0-alpha.41",
|
|
52
|
+
"@lwrjs/config": "0.15.0-alpha.41",
|
|
53
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.41",
|
|
54
|
+
"@lwrjs/esbuild": "0.15.0-alpha.41",
|
|
55
|
+
"@lwrjs/fs-asset-provider": "0.15.0-alpha.41",
|
|
56
|
+
"@lwrjs/fs-watch": "0.15.0-alpha.41",
|
|
57
|
+
"@lwrjs/html-view-provider": "0.15.0-alpha.41",
|
|
58
|
+
"@lwrjs/instrumentation": "0.15.0-alpha.41",
|
|
59
|
+
"@lwrjs/loader": "0.15.0-alpha.41",
|
|
60
|
+
"@lwrjs/lwc-module-provider": "0.15.0-alpha.41",
|
|
61
|
+
"@lwrjs/lwc-ssr": "0.15.0-alpha.41",
|
|
62
|
+
"@lwrjs/markdown-view-provider": "0.15.0-alpha.41",
|
|
63
|
+
"@lwrjs/module-bundler": "0.15.0-alpha.41",
|
|
64
|
+
"@lwrjs/module-registry": "0.15.0-alpha.41",
|
|
65
|
+
"@lwrjs/npm-module-provider": "0.15.0-alpha.41",
|
|
66
|
+
"@lwrjs/nunjucks-view-provider": "0.15.0-alpha.41",
|
|
67
|
+
"@lwrjs/o11y": "0.15.0-alpha.41",
|
|
68
|
+
"@lwrjs/resource-registry": "0.15.0-alpha.41",
|
|
69
|
+
"@lwrjs/router": "0.15.0-alpha.41",
|
|
70
|
+
"@lwrjs/server": "0.15.0-alpha.41",
|
|
71
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.41",
|
|
72
|
+
"@lwrjs/static": "0.15.0-alpha.41",
|
|
73
|
+
"@lwrjs/view-registry": "0.15.0-alpha.41",
|
|
74
74
|
"chokidar": "^3.6.0",
|
|
75
75
|
"esbuild": "^0.9.7",
|
|
76
76
|
"fs-extra": "^11.2.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ws": "^8.18.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
83
|
+
"@lwrjs/types": "0.15.0-alpha.41",
|
|
84
84
|
"@types/ws": "^8.5.12",
|
|
85
85
|
"memfs": "^4.13.0"
|
|
86
86
|
},
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"volta": {
|
|
94
94
|
"extends": "../../../package.json"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "26a304d3a5f92daf1d3eff3d9c937eccf1372fd3"
|
|
97
97
|
}
|