@lwrjs/view-registry 0.17.2-alpha.21 → 0.17.2-alpha.22
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 +31 -22
- package/build/es/index.js +33 -24
- package/package.json +7 -7
package/build/cjs/index.cjs
CHANGED
|
@@ -336,19 +336,27 @@ var LwrViewRegistry = class {
|
|
|
336
336
|
}
|
|
337
337
|
}, (span) => {
|
|
338
338
|
traceId = span.traceId;
|
|
339
|
-
let linkedMetadata2 = renderedViewMetadata;
|
|
340
|
-
if (!skipMetadataCollection) {
|
|
341
|
-
const contentHash = (0, import_crypto.createHash)("md5").update(renderedViewContent).digest("hex");
|
|
342
|
-
const cacheKey = `${view.id}:${contentHash}`;
|
|
343
|
-
if (this.metadataCache.has(cacheKey)) {
|
|
344
|
-
linkedMetadata2 = this.metadataCache.get(cacheKey);
|
|
345
|
-
} else {
|
|
346
|
-
linkedMetadata2 = (0, import_shared_utils.extractMetadataFromHtml)(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
347
|
-
this.metadataCache.set(cacheKey, linkedMetadata2);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
339
|
const stringBuilder2 = (0, import_shared_utils.createStringBuilder)(renderedViewContent);
|
|
351
|
-
|
|
340
|
+
if (skipMetadataCollection) {
|
|
341
|
+
return {linkedMetadata: renderedViewMetadata, stringBuilder: stringBuilder2};
|
|
342
|
+
}
|
|
343
|
+
const contentHash = (0, import_crypto.createHash)("md5").update(renderedViewContent).digest("hex");
|
|
344
|
+
const cacheKey = `${view.id}:${contentHash}`;
|
|
345
|
+
let metadata;
|
|
346
|
+
if (this.metadataCache.has(cacheKey)) {
|
|
347
|
+
metadata = this.metadataCache.get(cacheKey);
|
|
348
|
+
} else {
|
|
349
|
+
metadata = (0, import_shared_utils.extractMetadataFromHtml)(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
350
|
+
this.metadataCache.set(cacheKey, metadata);
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
linkedMetadata: {
|
|
354
|
+
...renderedViewMetadata,
|
|
355
|
+
customElements: metadata.customElements,
|
|
356
|
+
assetReferences: metadata.assetReferences
|
|
357
|
+
},
|
|
358
|
+
stringBuilder: stringBuilder2
|
|
359
|
+
};
|
|
352
360
|
});
|
|
353
361
|
if (!(0, import_shared_utils.getFeatureFlags)().DISABLE_B3_TRACING && traceId && runtimeParams.viewSpanID) {
|
|
354
362
|
const content = `00-${traceId}-${runtimeParams.viewSpanID}-01`;
|
|
@@ -385,23 +393,24 @@ var LwrViewRegistry = class {
|
|
|
385
393
|
unsafeEnableViewLinkCaching: this.globalConfig.unsafeEnableViewLinkCaching,
|
|
386
394
|
viewLinkCacheKey: viewCacheKey
|
|
387
395
|
});
|
|
396
|
+
const assetReferences = [...linkedMetadata.assetReferences];
|
|
388
397
|
if (viewRecord.resources?.length) {
|
|
389
|
-
|
|
390
|
-
if (!
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
398
|
+
for (const resource of viewRecord.resources) {
|
|
399
|
+
if (!resource.src) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
assetReferences.push({
|
|
403
|
+
url: resource.src,
|
|
404
|
+
relative: (0, import_shared_utils.isRelative)(resource.src),
|
|
405
|
+
integrity: resource.integrity
|
|
396
406
|
});
|
|
397
|
-
|
|
398
|
-
}, []));
|
|
407
|
+
}
|
|
399
408
|
}
|
|
400
409
|
return {
|
|
401
410
|
renderedView: linkedView,
|
|
402
411
|
immutable,
|
|
403
412
|
viewRecord: {
|
|
404
|
-
assetReferences: (0, import_utils.reduceSourceAssetReferences)(
|
|
413
|
+
assetReferences: (0, import_utils.reduceSourceAssetReferences)(assetReferences),
|
|
405
414
|
...viewRecord,
|
|
406
415
|
serverBundles: linkedMetadata.serverBundles
|
|
407
416
|
},
|
package/build/es/index.js
CHANGED
|
@@ -364,21 +364,29 @@ export class LwrViewRegistry {
|
|
|
364
364
|
},
|
|
365
365
|
}, (span) => {
|
|
366
366
|
traceId = span.traceId;
|
|
367
|
-
let linkedMetadata = renderedViewMetadata;
|
|
368
|
-
if (!skipMetadataCollection) {
|
|
369
|
-
// Create a unique key based on view ID and content hash
|
|
370
|
-
const contentHash = createHash('md5').update(renderedViewContent).digest('hex');
|
|
371
|
-
const cacheKey = `${view.id}:${contentHash}`;
|
|
372
|
-
if (this.metadataCache.has(cacheKey)) {
|
|
373
|
-
linkedMetadata = this.metadataCache.get(cacheKey);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
linkedMetadata = extractMetadataFromHtml(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
377
|
-
this.metadataCache.set(cacheKey, linkedMetadata);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
367
|
const stringBuilder = createStringBuilder(renderedViewContent);
|
|
381
|
-
|
|
368
|
+
if (skipMetadataCollection) {
|
|
369
|
+
return { linkedMetadata: renderedViewMetadata, stringBuilder };
|
|
370
|
+
}
|
|
371
|
+
// Create a unique key based on view ID and content hash
|
|
372
|
+
const contentHash = createHash('md5').update(renderedViewContent).digest('hex');
|
|
373
|
+
const cacheKey = `${view.id}:${contentHash}`;
|
|
374
|
+
let metadata;
|
|
375
|
+
if (this.metadataCache.has(cacheKey)) {
|
|
376
|
+
metadata = this.metadataCache.get(cacheKey);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
metadata = extractMetadataFromHtml(renderedViewContent, renderedViewMetadata, this.globalConfig);
|
|
380
|
+
this.metadataCache.set(cacheKey, metadata);
|
|
381
|
+
}
|
|
382
|
+
return {
|
|
383
|
+
linkedMetadata: {
|
|
384
|
+
...renderedViewMetadata,
|
|
385
|
+
customElements: metadata.customElements,
|
|
386
|
+
assetReferences: metadata.assetReferences,
|
|
387
|
+
},
|
|
388
|
+
stringBuilder,
|
|
389
|
+
};
|
|
382
390
|
});
|
|
383
391
|
// Add distributed tracing meta tag to pass tracing info to the client
|
|
384
392
|
// {version}-{traceId}-{spanId}-{sampleDecision} and version is always 00
|
|
@@ -424,24 +432,25 @@ export class LwrViewRegistry {
|
|
|
424
432
|
// Use the same cache key for the link stage
|
|
425
433
|
viewLinkCacheKey: viewCacheKey,
|
|
426
434
|
});
|
|
435
|
+
const assetReferences = [...linkedMetadata.assetReferences];
|
|
427
436
|
if (viewRecord.resources?.length) {
|
|
428
|
-
|
|
429
|
-
if (!
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
437
|
+
for (const resource of viewRecord.resources) {
|
|
438
|
+
if (!resource.src) {
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
assetReferences.push({
|
|
442
|
+
url: resource.src,
|
|
443
|
+
relative: isRelative(resource.src),
|
|
444
|
+
integrity: resource.integrity,
|
|
435
445
|
});
|
|
436
|
-
|
|
437
|
-
}, []));
|
|
446
|
+
}
|
|
438
447
|
}
|
|
439
448
|
return {
|
|
440
449
|
// ...viewDefinition,
|
|
441
450
|
renderedView: linkedView,
|
|
442
451
|
immutable,
|
|
443
452
|
viewRecord: {
|
|
444
|
-
assetReferences: reduceSourceAssetReferences(
|
|
453
|
+
assetReferences: reduceSourceAssetReferences(assetReferences),
|
|
445
454
|
...viewRecord,
|
|
446
455
|
serverBundles: linkedMetadata.serverBundles,
|
|
447
456
|
},
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.22",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.17.2-alpha.
|
|
37
|
-
"@lwrjs/diagnostics": "0.17.2-alpha.
|
|
38
|
-
"@lwrjs/instrumentation": "0.17.2-alpha.
|
|
39
|
-
"@lwrjs/shared-utils": "0.17.2-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.17.2-alpha.22",
|
|
37
|
+
"@lwrjs/diagnostics": "0.17.2-alpha.22",
|
|
38
|
+
"@lwrjs/instrumentation": "0.17.2-alpha.22",
|
|
39
|
+
"@lwrjs/shared-utils": "0.17.2-alpha.22",
|
|
40
40
|
"lru-cache": "^10.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
43
|
+
"@lwrjs/types": "0.17.2-alpha.22"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=20.0.0"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"volta": {
|
|
49
49
|
"extends": "../../../package.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "89460a05096fe25860f06a9bea2c5c9a25b9cf05"
|
|
52
52
|
}
|