@lwrjs/view-registry 0.15.0-alpha.34 → 0.15.0-alpha.35
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/utils.cjs +18 -7
- package/build/es/utils.js +18 -9
- package/package.json +9 -8
package/build/cjs/utils.cjs
CHANGED
|
@@ -46,6 +46,7 @@ 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"));
|
|
49
50
|
function generateExternalStyle(src) {
|
|
50
51
|
return `<link rel="stylesheet" href="${src}">`;
|
|
51
52
|
}
|
|
@@ -305,14 +306,24 @@ function addExternalScriptNonce(def, nonce) {
|
|
|
305
306
|
}
|
|
306
307
|
function generateLinkHeaders(assets, patterns) {
|
|
307
308
|
const assetConfig = {};
|
|
308
|
-
for (
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
for (const assetRef of assets) {
|
|
310
|
+
const path = (assetRef.override?.uri || assetRef.url).split("?")[0];
|
|
311
|
+
let matched = null;
|
|
312
|
+
for (const pattern of patterns) {
|
|
313
|
+
const {match} = pattern;
|
|
314
|
+
const matchPatterns = Array.isArray(match) ? match : [match];
|
|
315
|
+
for (const filePattern of matchPatterns) {
|
|
316
|
+
if ((0, import_minimatch.minimatch)(path, filePattern)) {
|
|
317
|
+
matched = pattern.attributes;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
314
320
|
}
|
|
315
|
-
|
|
321
|
+
if (matched)
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
if (matched) {
|
|
325
|
+
assetConfig[path] = matched;
|
|
326
|
+
}
|
|
316
327
|
}
|
|
317
328
|
return Object.keys(assetConfig).reduce((linkHeader, path) => {
|
|
318
329
|
linkHeader = `${linkHeader ? linkHeader + ", " : ""}<${path}>`;
|
package/build/es/utils.js
CHANGED
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
function generateExternalStyle(src) {
|
|
6
7
|
return `<link rel="stylesheet" href="${src}">`;
|
|
7
8
|
}
|
|
@@ -291,16 +292,24 @@ export function addExternalScriptNonce(def, nonce) {
|
|
|
291
292
|
export function generateLinkHeaders(assets, patterns) {
|
|
292
293
|
// store each Path's config in this config
|
|
293
294
|
const assetConfig = {};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
295
|
+
for (const assetRef of assets) {
|
|
296
|
+
const path = (assetRef.override?.uri || assetRef.url).split('?')[0];
|
|
297
|
+
let matched = null;
|
|
298
|
+
for (const pattern of patterns) {
|
|
299
|
+
const { match } = pattern;
|
|
300
|
+
const matchPatterns = Array.isArray(match) ? match : [match];
|
|
301
|
+
for (const filePattern of matchPatterns) {
|
|
302
|
+
if (minimatch(path, filePattern)) {
|
|
303
|
+
matched = pattern.attributes;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
302
306
|
}
|
|
303
|
-
|
|
307
|
+
if (matched)
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
if (matched) {
|
|
311
|
+
assetConfig[path] = matched;
|
|
312
|
+
}
|
|
304
313
|
}
|
|
305
314
|
// Use the assetConfig to construct the Link Header
|
|
306
315
|
return Object.keys(assetConfig).reduce((linkHeader, path) => {
|
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.35",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,14 +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.
|
|
40
|
-
"lru-cache": "^10.4.3"
|
|
36
|
+
"@lwrjs/app-service": "0.15.0-alpha.35",
|
|
37
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.35",
|
|
38
|
+
"@lwrjs/instrumentation": "0.15.0-alpha.35",
|
|
39
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.35",
|
|
40
|
+
"lru-cache": "^10.4.3",
|
|
41
|
+
"minimatch": "^10.0.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
44
|
+
"@lwrjs/types": "0.15.0-alpha.35"
|
|
44
45
|
},
|
|
45
46
|
"engines": {
|
|
46
47
|
"node": ">=18.0.0"
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"volta": {
|
|
49
50
|
"extends": "../../../package.json"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "42f04ad68558ec00f543a04e363671ceb294c88b"
|
|
52
53
|
}
|