@lwrjs/view-registry 0.17.2-alpha.2 → 0.17.2-alpha.4

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.
@@ -370,7 +370,8 @@ var LwrViewRegistry = class {
370
370
  return res;
371
371
  res.push({
372
372
  url: asset.src,
373
- relative: (0, import_shared_utils.isRelative)(asset.src)
373
+ relative: (0, import_shared_utils.isRelative)(asset.src),
374
+ integrity: asset.integrity
374
375
  });
375
376
  return res;
376
377
  }, []));
@@ -31,7 +31,7 @@ var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
31
31
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
32
32
  function setPreloadModulesMeta(specifier, uri, integrity, groups, preloads) {
33
33
  if (!uri) {
34
- throw new import_diagnostics.LwrApplicationError(import_diagnostics.descriptions.APPLICATION.PRELOAD_MODULE(specifier));
34
+ throw new import_diagnostics.LwrInvalidError(import_diagnostics.descriptions.INVALID.PRELOAD_MODULE(specifier));
35
35
  }
36
36
  const [removedVersion, version] = specifier.split("/v/");
37
37
  const normalizedSpecifier = version === import_shared_utils.VERSION_NOT_PROVIDED ? removedVersion : specifier;
@@ -132,11 +132,12 @@ function normalizeRenderedResult({
132
132
  };
133
133
  }
134
134
  function reduceSourceAssetReferences(assets) {
135
- return assets.map(({url, tagName, override}) => {
135
+ return assets.map(({url, tagName, override, integrity}) => {
136
136
  return {
137
137
  url,
138
138
  tagName,
139
- override
139
+ override,
140
+ integrity
140
141
  };
141
142
  });
142
143
  }
@@ -314,7 +315,7 @@ function generateLinkHeaders(assets, patterns) {
314
315
  for (const filePattern of matchPatterns) {
315
316
  const regex = new RegExp(filePattern);
316
317
  if (regex.test(path)) {
317
- matched = pattern.attributes;
318
+ matched = pattern.attributes || {};
318
319
  break;
319
320
  }
320
321
  }
@@ -323,6 +324,9 @@ function generateLinkHeaders(assets, patterns) {
323
324
  }
324
325
  if (matched) {
325
326
  assetConfig[path] = matched;
327
+ if (assetRef.integrity) {
328
+ assetConfig[path].integrity = assetRef.integrity;
329
+ }
326
330
  }
327
331
  }
328
332
  return Object.keys(assetConfig).reduce((linkHeader, path) => {
package/build/es/index.js CHANGED
@@ -406,6 +406,7 @@ export class LwrViewRegistry {
406
406
  res.push({
407
407
  url: asset.src,
408
408
  relative: isRelative(asset.src),
409
+ integrity: asset.integrity,
409
410
  });
410
411
  return res;
411
412
  }, []));
@@ -1,4 +1,4 @@
1
- import { LwrApplicationError, descriptions, logger } from '@lwrjs/diagnostics';
1
+ import { LwrInvalidError, descriptions, logger } from '@lwrjs/diagnostics';
2
2
  import { explodeSpecifier, getGroupName, getVersionedModuleId, normalizeVersionToUri, VERSION_NOT_PROVIDED, getSpecifier, isGroupie, } from '@lwrjs/shared-utils';
3
3
  /**
4
4
  * keeps track of preloadModules metadata
@@ -6,7 +6,7 @@ import { explodeSpecifier, getGroupName, getVersionedModuleId, normalizeVersionT
6
6
  export function setPreloadModulesMeta(specifier, uri, integrity, groups, preloads) {
7
7
  // Throw a very specific error if we get this back and the uri property is not set
8
8
  if (!uri) {
9
- throw new LwrApplicationError(descriptions.APPLICATION.PRELOAD_MODULE(specifier));
9
+ throw new LwrInvalidError(descriptions.INVALID.PRELOAD_MODULE(specifier));
10
10
  }
11
11
  // We need to support version-less preloadModules, including version-less rootComponents.
12
12
  // Removing the "/v/version_not_provided" hack from the preloadModules specifier
package/build/es/utils.js CHANGED
@@ -84,11 +84,12 @@ export function normalizeRenderedResult({ renderedView, metadata, options, cache
84
84
  };
85
85
  }
86
86
  export function reduceSourceAssetReferences(assets) {
87
- return assets.map(({ url, tagName, override }) => {
87
+ return assets.map(({ url, tagName, override, integrity }) => {
88
88
  return {
89
89
  url,
90
90
  tagName,
91
91
  override,
92
+ integrity,
92
93
  };
93
94
  });
94
95
  }
@@ -300,7 +301,7 @@ export function generateLinkHeaders(assets, patterns) {
300
301
  for (const filePattern of matchPatterns) {
301
302
  const regex = new RegExp(filePattern);
302
303
  if (regex.test(path)) {
303
- matched = pattern.attributes;
304
+ matched = pattern.attributes || {};
304
305
  break;
305
306
  }
306
307
  }
@@ -309,6 +310,10 @@ export function generateLinkHeaders(assets, patterns) {
309
310
  }
310
311
  if (matched) {
311
312
  assetConfig[path] = matched;
313
+ if (assetRef.integrity) {
314
+ // always add the integrity attribute, if it exists
315
+ assetConfig[path].integrity = assetRef.integrity;
316
+ }
312
317
  }
313
318
  }
314
319
  // Use the assetConfig to construct the Link Header
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.17.2-alpha.2",
7
+ "version": "0.17.2-alpha.4",
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.2",
37
- "@lwrjs/diagnostics": "0.17.2-alpha.2",
38
- "@lwrjs/instrumentation": "0.17.2-alpha.2",
39
- "@lwrjs/shared-utils": "0.17.2-alpha.2",
36
+ "@lwrjs/app-service": "0.17.2-alpha.4",
37
+ "@lwrjs/diagnostics": "0.17.2-alpha.4",
38
+ "@lwrjs/instrumentation": "0.17.2-alpha.4",
39
+ "@lwrjs/shared-utils": "0.17.2-alpha.4",
40
40
  "lru-cache": "^10.4.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@lwrjs/types": "0.17.2-alpha.2"
43
+ "@lwrjs/types": "0.17.2-alpha.4"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=18.0.0"
@@ -48,5 +48,5 @@
48
48
  "volta": {
49
49
  "extends": "../../../package.json"
50
50
  },
51
- "gitHead": "739b237f5d7f2c1989142cb505a56cc763f21976"
51
+ "gitHead": "d7fb1605cec0bf9fef18e3daeb17dc28b35a80d3"
52
52
  }