@unhead/vue 1.0.1 → 1.0.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
@@ -266,6 +266,14 @@ async function normaliseProps(props) {
266
266
  const tagWeight = (tag) => {
267
267
  if (typeof tag.tagPriority === "number")
268
268
  return tag.tagPriority;
269
+ switch (tag.tagPriority) {
270
+ case "critical":
271
+ return 2;
272
+ case "high":
273
+ return 9;
274
+ case "low":
275
+ return 12;
276
+ }
269
277
  switch (tag.tag) {
270
278
  case "base":
271
279
  return -1;
@@ -316,7 +324,7 @@ const renderTitleTemplate = (template, title) => {
316
324
  return template.replace("%s", title ?? "");
317
325
  };
318
326
  function resolveTitleTemplateFromTags(tags) {
319
- const titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
327
+ let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
320
328
  const titleIdx = tags.findIndex((i) => i.tag === "title");
321
329
  if (titleIdx !== -1 && titleTemplateIdx !== -1) {
322
330
  const newTitle = renderTitleTemplate(
@@ -335,6 +343,7 @@ function resolveTitleTemplateFromTags(tags) {
335
343
  if (newTitle !== null) {
336
344
  tags[titleTemplateIdx].children = newTitle;
337
345
  tags[titleTemplateIdx].tag = "title";
346
+ titleTemplateIdx = -1;
338
347
  }
339
348
  }
340
349
  if (titleTemplateIdx !== -1) {
package/dist/index.mjs CHANGED
@@ -264,6 +264,14 @@ async function normaliseProps(props) {
264
264
  const tagWeight = (tag) => {
265
265
  if (typeof tag.tagPriority === "number")
266
266
  return tag.tagPriority;
267
+ switch (tag.tagPriority) {
268
+ case "critical":
269
+ return 2;
270
+ case "high":
271
+ return 9;
272
+ case "low":
273
+ return 12;
274
+ }
267
275
  switch (tag.tag) {
268
276
  case "base":
269
277
  return -1;
@@ -314,7 +322,7 @@ const renderTitleTemplate = (template, title) => {
314
322
  return template.replace("%s", title ?? "");
315
323
  };
316
324
  function resolveTitleTemplateFromTags(tags) {
317
- const titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
325
+ let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
318
326
  const titleIdx = tags.findIndex((i) => i.tag === "title");
319
327
  if (titleIdx !== -1 && titleTemplateIdx !== -1) {
320
328
  const newTitle = renderTitleTemplate(
@@ -333,6 +341,7 @@ function resolveTitleTemplateFromTags(tags) {
333
341
  if (newTitle !== null) {
334
342
  tags[titleTemplateIdx].children = newTitle;
335
343
  tags[titleTemplateIdx].tag = "title";
344
+ titleTemplateIdx = -1;
336
345
  }
337
346
  }
338
347
  if (titleTemplateIdx !== -1) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.0.1",
5
- "packageManager": "pnpm@7.14.0",
4
+ "version": "1.0.3",
5
+ "packageManager": "pnpm@7.17.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -33,12 +33,12 @@
33
33
  "vue": ">=2.7 || >=3"
34
34
  },
35
35
  "dependencies": {
36
- "@unhead/schema": "1.0.1",
37
- "hookable": "^5.4.1"
36
+ "hookable": "^5.4.2",
37
+ "@unhead/schema": "1.0.3"
38
38
  },
39
39
  "devDependencies": {
40
- "unhead": "1.0.1",
41
- "vue": "^3.2.45"
40
+ "vue": "^3.2.45",
41
+ "unhead": "1.0.3"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild .",