@unhead/shared 1.7.0 → 1.7.3

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/dist/index.cjs CHANGED
@@ -594,9 +594,6 @@ async function normaliseTag(tagName, input, e) {
594
594
  if (typeof tag.innerHTML === "object") {
595
595
  tag.innerHTML = JSON.stringify(tag.innerHTML);
596
596
  tag.props.type = tag.props.type || "application/json";
597
- } else if (tag.tag === "script" && tag.innerHTML && (/^(https?:)?\/\//.test(tag.innerHTML) || tag.innerHTML.startsWith("/"))) {
598
- tag.props.src = tag.innerHTML;
599
- delete tag.innerHTML;
600
597
  }
601
598
  if (tag.innerHTML && ["application/ld+json", "application/json"].includes(tag.props.type))
602
599
  tag.innerHTML = tag.innerHTML.replace(/</g, "\\u003C");
@@ -664,10 +661,12 @@ function tagWeight(tag) {
664
661
  if (typeof priority === "number")
665
662
  return priority;
666
663
  if (tag.tag === "meta") {
664
+ if (tag.props["http-equiv"] === "content-security-policy")
665
+ weight = -30;
667
666
  if (tag.props.charset)
668
667
  weight = -20;
669
- if (tag.props["http-equiv"] === "content-security-policy")
670
- weight = 0;
668
+ if (tag.props.name === "viewport")
669
+ weight = -15;
671
670
  } else if (tag.tag === "link" && tag.props.rel === "preconnect") {
672
671
  weight = 20;
673
672
  } else if (tag.tag in TAG_WEIGHTS) {
package/dist/index.mjs CHANGED
@@ -592,9 +592,6 @@ async function normaliseTag(tagName, input, e) {
592
592
  if (typeof tag.innerHTML === "object") {
593
593
  tag.innerHTML = JSON.stringify(tag.innerHTML);
594
594
  tag.props.type = tag.props.type || "application/json";
595
- } else if (tag.tag === "script" && tag.innerHTML && (/^(https?:)?\/\//.test(tag.innerHTML) || tag.innerHTML.startsWith("/"))) {
596
- tag.props.src = tag.innerHTML;
597
- delete tag.innerHTML;
598
595
  }
599
596
  if (tag.innerHTML && ["application/ld+json", "application/json"].includes(tag.props.type))
600
597
  tag.innerHTML = tag.innerHTML.replace(/</g, "\\u003C");
@@ -662,10 +659,12 @@ function tagWeight(tag) {
662
659
  if (typeof priority === "number")
663
660
  return priority;
664
661
  if (tag.tag === "meta") {
662
+ if (tag.props["http-equiv"] === "content-security-policy")
663
+ weight = -30;
665
664
  if (tag.props.charset)
666
665
  weight = -20;
667
- if (tag.props["http-equiv"] === "content-security-policy")
668
- weight = 0;
666
+ if (tag.props.name === "viewport")
667
+ weight = -15;
669
668
  } else if (tag.tag === "link" && tag.props.rel === "preconnect") {
670
669
  weight = 20;
671
670
  } else if (tag.tag in TAG_WEIGHTS) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/shared",
3
3
  "type": "module",
4
- "version": "1.7.0",
4
+ "version": "1.7.3",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@unhead/schema": "1.7.0"
37
+ "@unhead/schema": "1.7.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "packrup": "^0.1.0"