@lwrjs/shared-utils 0.22.17 → 0.22.19

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.
@@ -89,11 +89,11 @@ function shortestTtl(newTtl, oldTtl, maxTtl) {
89
89
  return shortest;
90
90
  }
91
91
  function createMetaTags(meta) {
92
- return meta.reduce((metaStr, {name, content, httpEquiv}) => {
93
- if (!name && !content && !httpEquiv)
92
+ return meta.reduce((metaStr, {name, content, httpEquiv, property, itemprop}) => {
93
+ if (!name && !content && !httpEquiv && !property && !itemprop)
94
94
  return metaStr;
95
- const nameStr = name ? ` name="${name}"` : "", httpEquivStr = httpEquiv ? ` http-equiv="${httpEquiv}"` : "", contentStr = content ? ` content="${content}"` : "";
96
- return metaStr + `<meta${nameStr}${httpEquivStr}${contentStr}>
95
+ const nameStr = name ? ` name="${name}"` : "", httpEquivStr = httpEquiv ? ` http-equiv="${httpEquiv}"` : "", propertyStr = property ? ` property="${property}"` : "", itempropStr = itemprop ? ` itemprop="${itemprop}"` : "", contentStr = content ? ` content="${content}"` : "";
96
+ return metaStr + `<meta${nameStr}${httpEquivStr}${propertyStr}${itempropStr}${contentStr}>
97
97
  `;
98
98
  }, "");
99
99
  }
@@ -102,9 +102,9 @@ function createScriptTags(scripts) {
102
102
  `, "");
103
103
  }
104
104
  function createLinkTags(links) {
105
- return links.reduce((linkStr, {href, rel, as, fetchpriority}) => {
106
- const relStr = rel ? ` rel="${rel}"` : "", asStr = as ? ` as="${as}"` : "", fetchStr = fetchpriority ? ` fetchpriority="${fetchpriority}"` : "";
107
- return linkStr + `<link href="${href}"${relStr}${asStr}${fetchStr}>
105
+ return links.reduce((linkStr, {href, rel, as, fetchpriority, type, sizes, hreflang, media, crossorigin}) => {
106
+ const relStr = rel ? ` rel="${rel}"` : "", asStr = as ? ` as="${as}"` : "", fetchStr = fetchpriority ? ` fetchpriority="${fetchpriority}"` : "", typeStr = type ? ` type="${type}"` : "", sizesStr = sizes ? ` sizes="${sizes}"` : "", hreflangStr = hreflang ? ` hreflang="${hreflang}"` : "", mediaStr = media ? ` media="${media}"` : "", crossoriginStr = crossorigin !== void 0 ? ` crossorigin="${crossorigin}"` : "";
107
+ return linkStr + `<link href="${href}"${relStr}${asStr}${fetchStr}${typeStr}${sizesStr}${hreflangStr}${mediaStr}${crossoriginStr}>
108
108
  `;
109
109
  }, "");
110
110
  }
@@ -70,20 +70,26 @@ export function shortestTtl(newTtl, oldTtl, maxTtl) {
70
70
  }
71
71
  /** HEAD MARKUP UTILS */
72
72
  function createMetaTags(meta) {
73
- return meta.reduce((metaStr, { name, content, httpEquiv }) => {
74
- if (!name && !content && !httpEquiv)
73
+ return meta.reduce((metaStr, { name, content, httpEquiv, property, itemprop }) => {
74
+ if (!name && !content && !httpEquiv && !property && !itemprop)
75
75
  return metaStr; // do not create empty <meta> tags
76
- const nameStr = name ? ` name="${name}"` : '', httpEquivStr = httpEquiv ? ` http-equiv="${httpEquiv}"` : '', contentStr = content ? ` content="${content}"` : '';
77
- return metaStr + `<meta${nameStr}${httpEquivStr}${contentStr}>\n`;
76
+ const nameStr = name ? ` name="${name}"` : '', httpEquivStr = httpEquiv ? ` http-equiv="${httpEquiv}"` : '', propertyStr = property ? ` property="${property}"` : '', itempropStr = itemprop ? ` itemprop="${itemprop}"` : '', contentStr = content ? ` content="${content}"` : '';
77
+ return metaStr + `<meta${nameStr}${httpEquivStr}${propertyStr}${itempropStr}${contentStr}>\n`;
78
78
  }, '');
79
79
  }
80
80
  function createScriptTags(scripts) {
81
81
  return scripts.reduce((scriptStr, { body }) => scriptStr + `<script type="application/ld+json">${body}</script>\n`, '');
82
82
  }
83
83
  function createLinkTags(links) {
84
- return links.reduce((linkStr, { href, rel, as, fetchpriority }) => {
85
- const relStr = rel ? ` rel="${rel}"` : '', asStr = as ? ` as="${as}"` : '', fetchStr = fetchpriority ? ` fetchpriority="${fetchpriority}"` : '';
86
- return linkStr + `<link href="${href}"${relStr}${asStr}${fetchStr}>\n`;
84
+ return links.reduce((linkStr, { href, rel, as, fetchpriority, type, sizes, hreflang, media, crossorigin }) => {
85
+ const relStr = rel ? ` rel="${rel}"` : '', asStr = as ? ` as="${as}"` : '', fetchStr = fetchpriority ? ` fetchpriority="${fetchpriority}"` : '', typeStr = type ? ` type="${type}"` : '', sizesStr = sizes ? ` sizes="${sizes}"` : '', hreflangStr = hreflang ? ` hreflang="${hreflang}"` : '', mediaStr = media ? ` media="${media}"` : '',
86
+ // `crossorigin` is an enumerated CORS attribute: a present empty
87
+ // value (crossorigin="") enables anonymous CORS and differs from
88
+ // the attribute being absent. Preserve it on `undefined` rather
89
+ // than truthiness so `crossorigin: ''` is not silently dropped.
90
+ crossoriginStr = crossorigin !== undefined ? ` crossorigin="${crossorigin}"` : '';
91
+ return (linkStr +
92
+ `<link href="${href}"${relStr}${asStr}${fetchStr}${typeStr}${sizesStr}${hreflangStr}${mediaStr}${crossoriginStr}>\n`);
87
93
  }, '');
88
94
  }
89
95
  function createStyleTags(styles) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.22.17",
7
+ "version": "0.22.19",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.22.17",
40
+ "@lwrjs/diagnostics": "0.22.19",
41
41
  "es-module-lexer": "^1.5.4",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -50,7 +50,7 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.22.17",
53
+ "@lwrjs/types": "0.22.19",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0",
56
56
  "memfs": "^4.13.0"
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=22.0.0"
60
60
  },
61
- "gitHead": "cb61c362e500a24542c00ed1f751c288d258d42b"
61
+ "gitHead": "226d94a288f3e768a9d25bc0a32f2ec7d16b29dd"
62
62
  }