@lwrjs/view-registry 0.15.0-alpha.38 → 0.15.0-alpha.40
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 +11 -0
- package/build/cjs/utils.cjs +3 -3
- package/build/es/index.js +12 -1
- package/build/es/utils.js +3 -3
- package/package.json +8 -9
package/build/cjs/index.cjs
CHANGED
|
@@ -368,6 +368,17 @@ var LwrViewRegistry = class {
|
|
|
368
368
|
unsafeEnableViewLinkCaching: this.globalConfig.unsafeEnableViewLinkCaching,
|
|
369
369
|
viewLinkCacheKey: viewCacheKey
|
|
370
370
|
});
|
|
371
|
+
if (viewRecord.resources?.length) {
|
|
372
|
+
linkedMetadata.assetReferences.push(...viewRecord.resources.reduce((res, asset) => {
|
|
373
|
+
if (!asset.src)
|
|
374
|
+
return res;
|
|
375
|
+
res.push({
|
|
376
|
+
url: asset.src,
|
|
377
|
+
relative: (0, import_shared_utils.isRelative)(asset.src)
|
|
378
|
+
});
|
|
379
|
+
return res;
|
|
380
|
+
}, []));
|
|
381
|
+
}
|
|
371
382
|
return {
|
|
372
383
|
renderedView: linkedView,
|
|
373
384
|
immutable,
|
package/build/cjs/utils.cjs
CHANGED
|
@@ -46,7 +46,6 @@ var import_path = __toModule(require("path"));
|
|
|
46
46
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
47
47
|
var import_identity = __toModule(require("@lwrjs/app-service/identity"));
|
|
48
48
|
var import_crypto = __toModule(require("crypto"));
|
|
49
|
-
var import_minimatch = __toModule(require("minimatch"));
|
|
50
49
|
function generateExternalStyle(src) {
|
|
51
50
|
return `<link rel="stylesheet" href="${src}">`;
|
|
52
51
|
}
|
|
@@ -307,13 +306,14 @@ function addExternalScriptNonce(def, nonce) {
|
|
|
307
306
|
function generateLinkHeaders(assets, patterns) {
|
|
308
307
|
const assetConfig = {};
|
|
309
308
|
for (const assetRef of assets) {
|
|
310
|
-
const path =
|
|
309
|
+
const path = assetRef.override?.uri || assetRef.url;
|
|
311
310
|
let matched = null;
|
|
312
311
|
for (const pattern of patterns) {
|
|
313
312
|
const {match} = pattern;
|
|
314
313
|
const matchPatterns = Array.isArray(match) ? match : [match];
|
|
315
314
|
for (const filePattern of matchPatterns) {
|
|
316
|
-
|
|
315
|
+
const regex = new RegExp(filePattern);
|
|
316
|
+
if (regex.test(path)) {
|
|
317
317
|
matched = pattern.attributes;
|
|
318
318
|
break;
|
|
319
319
|
}
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKeyFromJson, getFeatureFlags, getSpecifier, isLambdaEnv, isLocalDev, normalizeResourcePath, shortestTtl, } from '@lwrjs/shared-utils';
|
|
1
|
+
import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKeyFromJson, getFeatureFlags, getSpecifier, isLambdaEnv, isLocalDev, normalizeResourcePath, shortestTtl, isRelative, } 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';
|
|
@@ -403,6 +403,17 @@ export class LwrViewRegistry {
|
|
|
403
403
|
// Use the same cache key for the link stage
|
|
404
404
|
viewLinkCacheKey: viewCacheKey,
|
|
405
405
|
});
|
|
406
|
+
if (viewRecord.resources?.length) {
|
|
407
|
+
linkedMetadata.assetReferences.push(...viewRecord.resources.reduce((res, asset) => {
|
|
408
|
+
if (!asset.src)
|
|
409
|
+
return res;
|
|
410
|
+
res.push({
|
|
411
|
+
url: asset.src,
|
|
412
|
+
relative: isRelative(asset.src),
|
|
413
|
+
});
|
|
414
|
+
return res;
|
|
415
|
+
}, []));
|
|
416
|
+
}
|
|
406
417
|
return {
|
|
407
418
|
// ...viewDefinition,
|
|
408
419
|
renderedView: linkedView,
|
package/build/es/utils.js
CHANGED
|
@@ -2,7 +2,6 @@ import { basename, extname } from 'path';
|
|
|
2
2
|
import { explodeSpecifier, getMappingUriPrefix, getSpecifier, getClientBootstrapConfigurationUri, mimeLookup, DEFAULT_TITLE, streamToString, getFeatureFlags, getCacheKeyFromJson, } from '@lwrjs/shared-utils';
|
|
3
3
|
import { AppResourceEnum, getAppSpecifier, ResourceIdentityTypes, } from '@lwrjs/app-service/identity';
|
|
4
4
|
import crypto from 'crypto';
|
|
5
|
-
import { minimatch } from 'minimatch';
|
|
6
5
|
function generateExternalStyle(src) {
|
|
7
6
|
return `<link rel="stylesheet" href="${src}">`;
|
|
8
7
|
}
|
|
@@ -293,13 +292,14 @@ export function generateLinkHeaders(assets, patterns) {
|
|
|
293
292
|
// store each Path's config in this config
|
|
294
293
|
const assetConfig = {};
|
|
295
294
|
for (const assetRef of assets) {
|
|
296
|
-
const path =
|
|
295
|
+
const path = assetRef.override?.uri || assetRef.url;
|
|
297
296
|
let matched = null;
|
|
298
297
|
for (const pattern of patterns) {
|
|
299
298
|
const { match } = pattern;
|
|
300
299
|
const matchPatterns = Array.isArray(match) ? match : [match];
|
|
301
300
|
for (const filePattern of matchPatterns) {
|
|
302
|
-
|
|
301
|
+
const regex = new RegExp(filePattern);
|
|
302
|
+
if (regex.test(path)) {
|
|
303
303
|
matched = pattern.attributes;
|
|
304
304
|
break;
|
|
305
305
|
}
|
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.40",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,15 +33,14 @@
|
|
|
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.
|
|
40
|
-
"lru-cache": "^10.4.3"
|
|
41
|
-
"minimatch": "9.0.5"
|
|
36
|
+
"@lwrjs/app-service": "0.15.0-alpha.40",
|
|
37
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.40",
|
|
38
|
+
"@lwrjs/instrumentation": "0.15.0-alpha.40",
|
|
39
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.40",
|
|
40
|
+
"lru-cache": "^10.4.3"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
43
|
+
"@lwrjs/types": "0.15.0-alpha.40"
|
|
45
44
|
},
|
|
46
45
|
"engines": {
|
|
47
46
|
"node": ">=18.0.0"
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"volta": {
|
|
50
49
|
"extends": "../../../package.json"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "327c965daff99a942bdf9f855f165febebd1835f"
|
|
53
52
|
}
|