@lwrjs/view-registry 0.13.0-alpha.20 → 0.13.0-alpha.21
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/build/cjs/index.cjs +2 -1
- package/build/es/index.js +5 -1
- package/package.json +7 -7
package/build/cjs/index.cjs
CHANGED
|
@@ -209,7 +209,8 @@ var LwrViewRegistry = class {
|
|
|
209
209
|
viewDefinition.nonce = (0, import_utils.getViewNonce)(updatableViewParams);
|
|
210
210
|
if (cacheDisabled === false) {
|
|
211
211
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
212
|
-
const
|
|
212
|
+
const maxTtl = process.env.MAX_VIEW_CACHE_TTL && parseInt(process.env.MAX_VIEW_CACHE_TTL, 10);
|
|
213
|
+
const ttl = (0, import_shared_utils.shortestTtl)(viewDefinition.cache?.ttl, route?.cache?.ttl, maxTtl);
|
|
213
214
|
if (ttl !== 0) {
|
|
214
215
|
this.viewDefinitions.set(viewDefCacheKey, {
|
|
215
216
|
view,
|
package/build/es/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKe
|
|
|
2
2
|
import { getTracer, ViewSpan } from '@lwrjs/instrumentation';
|
|
3
3
|
import { generateViewNonce, getViewNonce, normalizeRenderOptions, normalizeRenderedResult, reduceSourceAssetReferences, } from './utils.js';
|
|
4
4
|
import { linkLwrResources } from './linkers/link-lwr-resources.js';
|
|
5
|
+
// TODO: investigate perf impact W-16056356
|
|
5
6
|
import { LRUCache } from 'lru-cache';
|
|
6
7
|
import { DiagnosticsError, LwrServerError, createSingleDiagnosticError, descriptions, logger, } from '@lwrjs/diagnostics';
|
|
7
8
|
export { LwrViewHandler } from './view-handler.js';
|
|
@@ -215,7 +216,9 @@ export class LwrViewRegistry {
|
|
|
215
216
|
viewDefinition.nonce = getViewNonce(updatableViewParams);
|
|
216
217
|
if (cacheDisabled === false) {
|
|
217
218
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
218
|
-
|
|
219
|
+
// optionally set a max TTL on the view registry cache
|
|
220
|
+
const maxTtl = process.env.MAX_VIEW_CACHE_TTL && parseInt(process.env.MAX_VIEW_CACHE_TTL, 10);
|
|
221
|
+
const ttl = shortestTtl(viewDefinition.cache?.ttl, route?.cache?.ttl, maxTtl);
|
|
219
222
|
if (ttl !== 0) {
|
|
220
223
|
// cache view definition for the shortest ttl or until it is the least recently used when ttl is undefined
|
|
221
224
|
this.viewDefinitions.set(viewDefCacheKey, {
|
|
@@ -354,6 +357,7 @@ export class LwrViewRegistry {
|
|
|
354
357
|
importer: importer || renderedView.compiledView.filePath,
|
|
355
358
|
};
|
|
356
359
|
const stringBuilder = createStringBuilder(renderedViewContent);
|
|
360
|
+
// Note: this is the TTL for the page NOT for the view registry cache
|
|
357
361
|
let pageTtl = renderedView.cache.ttl;
|
|
358
362
|
for (const viewTransformer of this.viewTransformers) {
|
|
359
363
|
// eslint-disable-next-line no-await-in-loop
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.13.0-alpha.
|
|
7
|
+
"version": "0.13.0-alpha.21",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.13.0-alpha.
|
|
37
|
-
"@lwrjs/diagnostics": "0.13.0-alpha.
|
|
38
|
-
"@lwrjs/instrumentation": "0.13.0-alpha.
|
|
39
|
-
"@lwrjs/shared-utils": "0.13.0-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.13.0-alpha.21",
|
|
37
|
+
"@lwrjs/diagnostics": "0.13.0-alpha.21",
|
|
38
|
+
"@lwrjs/instrumentation": "0.13.0-alpha.21",
|
|
39
|
+
"@lwrjs/shared-utils": "0.13.0-alpha.21",
|
|
40
40
|
"lru-cache": "^10.2.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.13.0-alpha.
|
|
43
|
+
"@lwrjs/types": "0.13.0-alpha.21"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d272dcd07881fa469ee73bd28d2f30f99957e122"
|
|
49
49
|
}
|