@unhead/addons 1.9.15 → 1.9.16

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
@@ -9,11 +9,15 @@ function InferSeoMetaPlugin(options = {}) {
9
9
  entries: {
10
10
  resolve({ entries }) {
11
11
  let titleTemplate = null;
12
+ let lastWeight = 999;
12
13
  for (const entry of entries) {
13
14
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
14
15
  const input = entry[inputKey];
15
- if (typeof input.titleTemplate !== "undefined")
16
+ const weight = (typeof input.titleTemplate === "object" ? input.titleTemplate?.tagPriority : false) || entry.tagPriority || 100;
17
+ if (typeof input.titleTemplate !== "undefined" && weight <= lastWeight) {
16
18
  titleTemplate = input.titleTemplate;
19
+ lastWeight = weight;
20
+ }
17
21
  }
18
22
  for (const entry of entries) {
19
23
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
package/dist/index.mjs CHANGED
@@ -7,11 +7,15 @@ function InferSeoMetaPlugin(options = {}) {
7
7
  entries: {
8
8
  resolve({ entries }) {
9
9
  let titleTemplate = null;
10
+ let lastWeight = 999;
10
11
  for (const entry of entries) {
11
12
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
12
13
  const input = entry[inputKey];
13
- if (typeof input.titleTemplate !== "undefined")
14
+ const weight = (typeof input.titleTemplate === "object" ? input.titleTemplate?.tagPriority : false) || entry.tagPriority || 100;
15
+ if (typeof input.titleTemplate !== "undefined" && weight <= lastWeight) {
14
16
  titleTemplate = input.titleTemplate;
17
+ lastWeight = weight;
18
+ }
15
19
  }
16
20
  for (const entry of entries) {
17
21
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/addons",
3
3
  "type": "module",
4
- "version": "1.9.15",
4
+ "version": "1.9.16",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -55,8 +55,8 @@
55
55
  "ufo": "^1.5.3",
56
56
  "unplugin": "^1.11.0",
57
57
  "unplugin-ast": "^0.10.0",
58
- "@unhead/shared": "1.9.15",
59
- "@unhead/schema": "1.9.15"
58
+ "@unhead/schema": "1.9.16",
59
+ "@unhead/shared": "1.9.16"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/types": "^7.24.7",