@lwrjs/view-registry 0.15.0-alpha.35 → 0.15.0-alpha.37
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 +8 -4
- package/build/cjs/linkers/legacy_view_bootstrap.cjs +10 -1
- package/build/cjs/linkers/view_bootstrap.cjs +10 -1
- package/build/es/index.js +10 -5
- package/build/es/linkers/legacy_view_bootstrap.js +12 -2
- package/build/es/linkers/view_bootstrap.js +12 -2
- package/package.json +8 -8
package/build/cjs/index.cjs
CHANGED
|
@@ -54,7 +54,11 @@ var LwrViewRegistry = class {
|
|
|
54
54
|
this.viewDefinitions = new import_lru_cache.LRUCache({
|
|
55
55
|
max: parseInt(process.env.VIEW_CACHE_SIZE ?? "500", 10),
|
|
56
56
|
dispose: (_value, key) => {
|
|
57
|
-
|
|
57
|
+
if ((0, import_shared_utils.isLambdaEnv)()) {
|
|
58
|
+
import_diagnostics.logger.warn(`View evicted from cache ${key}`);
|
|
59
|
+
} else {
|
|
60
|
+
import_diagnostics.logger.verbose(`View evicted from cache ${key}`);
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
observer.onViewSourceChange(({payload}) => this.onViewSourceChange(payload));
|
|
@@ -318,14 +322,14 @@ var LwrViewRegistry = class {
|
|
|
318
322
|
metadata: renderedViewMetadata,
|
|
319
323
|
compiledView: {immutable = true}
|
|
320
324
|
} = renderedView;
|
|
321
|
-
const {linkedMetadata, stringBuilder} =
|
|
325
|
+
const {linkedMetadata, stringBuilder} = (0, import_instrumentation.getTracer)().trace({
|
|
322
326
|
name: import_instrumentation.ViewSpan.ParseView,
|
|
323
327
|
attributes: {
|
|
324
328
|
view: view.id,
|
|
325
329
|
ssr: view.bootstrap?.ssr === true
|
|
326
330
|
}
|
|
327
|
-
},
|
|
328
|
-
const linkedMetadata2 = skipMetadataCollection ? renderedViewMetadata :
|
|
331
|
+
}, () => {
|
|
332
|
+
const linkedMetadata2 = skipMetadataCollection ? renderedViewMetadata : (0, import_shared_utils.extractMetadataFromHtml)(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
329
333
|
const stringBuilder2 = (0, import_shared_utils.createStringBuilder)(renderedViewContent);
|
|
330
334
|
return {linkedMetadata: linkedMetadata2, stringBuilder: stringBuilder2};
|
|
331
335
|
});
|
|
@@ -41,7 +41,16 @@ function includeIdFactory(bundleConfig) {
|
|
|
41
41
|
return true;
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
var moduleGraphsCache = new import_lru_cache.LRUCache({
|
|
44
|
+
var moduleGraphsCache = new import_lru_cache.LRUCache({
|
|
45
|
+
max: 500,
|
|
46
|
+
dispose: (_value, key) => {
|
|
47
|
+
if ((0, import_shared_utils.isLambdaEnv)()) {
|
|
48
|
+
import_diagnostics.logger.warn(`Module graph evicted from cache ${key}`);
|
|
49
|
+
} else {
|
|
50
|
+
import_diagnostics.logger.verbose(`Module graph evicted from cache ${key}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
45
54
|
var isRunningLocalDev = (0, import_shared_utils.isLocalDev)();
|
|
46
55
|
async function getHtmlResources(view, viewParams, resourceContext) {
|
|
47
56
|
const {
|
|
@@ -34,7 +34,16 @@ var import_utils = __toModule(require("../utils.cjs"));
|
|
|
34
34
|
var import_utils2 = __toModule(require("./utils.cjs"));
|
|
35
35
|
var import_utils3 = __toModule(require("../utils.cjs"));
|
|
36
36
|
var import_preload_utils = __toModule(require("./preload-utils.cjs"));
|
|
37
|
-
var moduleGraphsCache = new import_lru_cache.LRUCache({
|
|
37
|
+
var moduleGraphsCache = new import_lru_cache.LRUCache({
|
|
38
|
+
max: 500,
|
|
39
|
+
dispose: (_value, key) => {
|
|
40
|
+
if ((0, import_shared_utils.isLambdaEnv)()) {
|
|
41
|
+
import_diagnostics.logger.warn(`Module graph evicted from cache ${key}`);
|
|
42
|
+
} else {
|
|
43
|
+
import_diagnostics.logger.verbose(`Module graph evicted from cache ${key}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
38
47
|
var isRunningLocalDev = (0, import_shared_utils.isLocalDev)();
|
|
39
48
|
async function getHtmlResources(view, viewParams, resourceContext) {
|
|
40
49
|
const {
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKeyFromJson, getFeatureFlags, getSpecifier, isLocalDev, normalizeResourcePath, shortestTtl, } from '@lwrjs/shared-utils';
|
|
1
|
+
import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKeyFromJson, getFeatureFlags, getSpecifier, isLambdaEnv, isLocalDev, normalizeResourcePath, shortestTtl, } from '@lwrjs/shared-utils';
|
|
2
2
|
import { getTracer, ViewSpan } from '@lwrjs/instrumentation';
|
|
3
3
|
import { generateViewNonce, getViewNonce, normalizeRenderOptions, normalizeRenderedResult, reduceSourceAssetReferences, getViewDefCacheKey, } from './utils.js';
|
|
4
4
|
import { linkLwrResources } from './linkers/link-lwr-resources.js';
|
|
@@ -33,7 +33,12 @@ export class LwrViewRegistry {
|
|
|
33
33
|
this.viewDefinitions = new LRUCache({
|
|
34
34
|
max: parseInt(process.env.VIEW_CACHE_SIZE ?? '500', 10),
|
|
35
35
|
dispose: (_value, key) => {
|
|
36
|
-
|
|
36
|
+
if (isLambdaEnv()) {
|
|
37
|
+
logger.warn(`View evicted from cache ${key}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
logger.verbose(`View evicted from cache ${key}`);
|
|
41
|
+
}
|
|
37
42
|
},
|
|
38
43
|
});
|
|
39
44
|
// Observers for cached entries external dependencies -- view templates, modules, and assets
|
|
@@ -342,16 +347,16 @@ export class LwrViewRegistry {
|
|
|
342
347
|
const runtimeEnvironment = { ...runtimeEnv, immutableAssets: freezeAssets };
|
|
343
348
|
// normalize/extract metadata
|
|
344
349
|
const { renderedView: renderedViewContent, metadata: renderedViewMetadata, compiledView: { immutable = true }, } = renderedView;
|
|
345
|
-
const { linkedMetadata, stringBuilder } =
|
|
350
|
+
const { linkedMetadata, stringBuilder } = getTracer().trace({
|
|
346
351
|
name: ViewSpan.ParseView,
|
|
347
352
|
attributes: {
|
|
348
353
|
view: view.id,
|
|
349
354
|
ssr: view.bootstrap?.ssr === true,
|
|
350
355
|
},
|
|
351
|
-
},
|
|
356
|
+
}, () => {
|
|
352
357
|
const linkedMetadata = skipMetadataCollection
|
|
353
358
|
? renderedViewMetadata
|
|
354
|
-
:
|
|
359
|
+
: extractMetadataFromHtml(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
355
360
|
const stringBuilder = createStringBuilder(renderedViewContent);
|
|
356
361
|
return { linkedMetadata, stringBuilder };
|
|
357
362
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, explodeSpecifier, isBundler, getHydrateDirective, isGroupie, isExternalSpecifier, isLocalDev, } from '@lwrjs/shared-utils';
|
|
2
|
+
import { kebabCaseToModuleSpecifier, getModuleGraphs, GraphDepth, getModuleUriPrefix, explodeSpecifier, isBundler, getHydrateDirective, isGroupie, isExternalSpecifier, isLocalDev, isLambdaEnv, } from '@lwrjs/shared-utils';
|
|
3
3
|
import { AppResourceEnum, getAppSpecifier } from '@lwrjs/app-service/identity';
|
|
4
4
|
import { addExternalScriptNonce, generateHtmlTag, getModuleResource, getModuleResourceByUri, getViewNonce, getModuleGraphCacheKey, } from '../utils.js';
|
|
5
5
|
import { flattenCustomElements, getBundleIntegrity, getViewBootstrapConfigurationResource, getViewHmrConfigurationResource, } from './utils.js';
|
|
@@ -18,7 +18,17 @@ function includeIdFactory(bundleConfig) {
|
|
|
18
18
|
}
|
|
19
19
|
// `getModuleGraphs` is very expensive and does not need to be recomputed every time.
|
|
20
20
|
// Note: we use the same cache key passed in from the top level view-registry for consistency
|
|
21
|
-
const moduleGraphsCache = new LRUCache({
|
|
21
|
+
const moduleGraphsCache = new LRUCache({
|
|
22
|
+
max: 500,
|
|
23
|
+
dispose: (_value, key) => {
|
|
24
|
+
if (isLambdaEnv()) {
|
|
25
|
+
logger.warn(`Module graph evicted from cache ${key}`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
logger.verbose(`Module graph evicted from cache ${key}`);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
22
32
|
const isRunningLocalDev = isLocalDev();
|
|
23
33
|
export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
24
34
|
const { runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler, resourceRegistry, viewMetadata, viewLinkCacheKey, } = resourceContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, explodeSpecifier, isBundler, getHydrateDirective, isGroupie, isLocalDev, } from '@lwrjs/shared-utils';
|
|
2
|
+
import { kebabCaseToModuleSpecifier, toImportMetadata, getModuleGraphs, getMappingUriPrefix, GraphDepth, explodeSpecifier, isBundler, getHydrateDirective, isGroupie, isLocalDev, isLambdaEnv, } from '@lwrjs/shared-utils';
|
|
3
3
|
import { LRUCache } from 'lru-cache';
|
|
4
4
|
import { AppResourceEnum, getAppSpecifier } from '@lwrjs/app-service/identity';
|
|
5
5
|
import { addExternalScriptNonce, generateHtmlTag, getModuleResourceByUri, getViewNonce } from '../utils.js';
|
|
@@ -8,7 +8,17 @@ import { getModuleGraphCacheKey } from '../utils.js';
|
|
|
8
8
|
import { setPreloadModulesMeta, getPreloadModulesMeta } from './preload-utils.js';
|
|
9
9
|
// `getModuleGraphs` is very expensive and does not need to be recomputed every time.
|
|
10
10
|
// Note: we use the same cache key passed in from the top level view-registry for consistency
|
|
11
|
-
const moduleGraphsCache = new LRUCache({
|
|
11
|
+
const moduleGraphsCache = new LRUCache({
|
|
12
|
+
max: 500,
|
|
13
|
+
dispose: (_value, key) => {
|
|
14
|
+
if (isLambdaEnv()) {
|
|
15
|
+
logger.warn(`Module graph evicted from cache ${key}`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
logger.verbose(`Module graph evicted from cache ${key}`);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
});
|
|
12
22
|
const isRunningLocalDev = isLocalDev();
|
|
13
23
|
export async function getHtmlResources(view, viewParams, resourceContext) {
|
|
14
24
|
const { runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler, resourceRegistry, viewMetadata, viewLinkCacheKey, } = resourceContext;
|
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.37",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.15.0-alpha.
|
|
37
|
-
"@lwrjs/diagnostics": "0.15.0-alpha.
|
|
38
|
-
"@lwrjs/instrumentation": "0.15.0-alpha.
|
|
39
|
-
"@lwrjs/shared-utils": "0.15.0-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.15.0-alpha.37",
|
|
37
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.37",
|
|
38
|
+
"@lwrjs/instrumentation": "0.15.0-alpha.37",
|
|
39
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.37",
|
|
40
40
|
"lru-cache": "^10.4.3",
|
|
41
|
-
"minimatch": "
|
|
41
|
+
"minimatch": "9.0.5"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
44
|
+
"@lwrjs/types": "0.15.0-alpha.37"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=18.0.0"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"volta": {
|
|
50
50
|
"extends": "../../../package.json"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "1211275df818eb68a933ea744c13c9f1a525bcd6"
|
|
53
53
|
}
|