@lwrjs/security 0.15.0-alpha.45 → 0.15.0-alpha.46

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.
@@ -79,9 +79,6 @@ async function getResourceHashes(viewResponse) {
79
79
  }
80
80
  return hashes;
81
81
  }
82
- function normalizeHeaders(headers = {}) {
83
- return Object.fromEntries(Object.entries(headers).map(([key, value]) => [key.toLowerCase(), value]));
84
- }
85
82
  function normalizeOptions(options = {}) {
86
83
  for (const [option, value] of Object.entries(options)) {
87
84
  if (value === true) {
@@ -92,7 +89,7 @@ function normalizeOptions(options = {}) {
92
89
  }
93
90
  async function resolveHeaders(viewResponse, options) {
94
91
  options = normalizeOptions(options);
95
- const headers = normalizeHeaders(viewResponse.headers);
92
+ const headers = (0, import_shared_utils.normalizeHeaders)(viewResponse.headers);
96
93
  if (options.contentSecurityPolicy === void 0 || typeof options.contentSecurityPolicy === "object") {
97
94
  const headerName = options.contentSecurityPolicy?.reportOnly ? "content-security-policy-report-only" : CSP_HEADER_NAME;
98
95
  let hashes = [];
@@ -1,4 +1,4 @@
1
- import { createIntegrityHash, getFeatureFlags, streamToString } from '@lwrjs/shared-utils';
1
+ import { createIntegrityHash, getFeatureFlags, streamToString, normalizeHeaders } from '@lwrjs/shared-utils';
2
2
  import contentSecurityPolicy from './headers/content-security-policy.js';
3
3
  import referrerPolicy from './headers/referrer-policy.js';
4
4
  import strictTransportSecurity from './headers/strict-transport-security.js';
@@ -56,9 +56,6 @@ async function getResourceHashes(viewResponse) {
56
56
  }
57
57
  return hashes;
58
58
  }
59
- function normalizeHeaders(headers = {}) {
60
- return Object.fromEntries(Object.entries(headers).map(([key, value]) => [key.toLowerCase(), value]));
61
- }
62
59
  function normalizeOptions(options = {}) {
63
60
  for (const [option, value] of Object.entries(options)) {
64
61
  // true values are the same as undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwrjs/security",
3
- "version": "0.15.0-alpha.45",
3
+ "version": "0.15.0-alpha.46",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "types": "build/es/index.d.ts",
@@ -32,14 +32,14 @@
32
32
  "build": "tsc -b"
33
33
  },
34
34
  "dependencies": {
35
- "@lwrjs/diagnostics": "0.15.0-alpha.45",
36
- "@lwrjs/shared-utils": "0.15.0-alpha.45"
35
+ "@lwrjs/diagnostics": "0.15.0-alpha.46",
36
+ "@lwrjs/shared-utils": "0.15.0-alpha.46"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwrjs/types": "0.15.0-alpha.45"
39
+ "@lwrjs/types": "0.15.0-alpha.46"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=18.0.0"
43
43
  },
44
- "gitHead": "9fa1a2ce015fedee28dd9ab5f711ed235e4b3353"
44
+ "gitHead": "366b77f76c34626c9449da0042766fc107cc6b8f"
45
45
  }