unhead 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 +10 -1
- package/dist/index.mjs +10 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -206,6 +206,14 @@ function changeKeyCasingDeep(input) {
|
|
|
206
206
|
const tagWeight = (tag) => {
|
|
207
207
|
if (typeof tag.tagPriority === "number")
|
|
208
208
|
return tag.tagPriority;
|
|
209
|
+
switch (tag.tagPriority) {
|
|
210
|
+
case "critical":
|
|
211
|
+
return 2;
|
|
212
|
+
case "high":
|
|
213
|
+
return 9;
|
|
214
|
+
case "low":
|
|
215
|
+
return 12;
|
|
216
|
+
}
|
|
209
217
|
switch (tag.tag) {
|
|
210
218
|
case "base":
|
|
211
219
|
return -1;
|
|
@@ -256,7 +264,7 @@ const renderTitleTemplate = (template, title) => {
|
|
|
256
264
|
return template.replace("%s", title ?? "");
|
|
257
265
|
};
|
|
258
266
|
function resolveTitleTemplateFromTags(tags) {
|
|
259
|
-
|
|
267
|
+
let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
|
|
260
268
|
const titleIdx = tags.findIndex((i) => i.tag === "title");
|
|
261
269
|
if (titleIdx !== -1 && titleTemplateIdx !== -1) {
|
|
262
270
|
const newTitle = renderTitleTemplate(
|
|
@@ -275,6 +283,7 @@ function resolveTitleTemplateFromTags(tags) {
|
|
|
275
283
|
if (newTitle !== null) {
|
|
276
284
|
tags[titleTemplateIdx].children = newTitle;
|
|
277
285
|
tags[titleTemplateIdx].tag = "title";
|
|
286
|
+
titleTemplateIdx = -1;
|
|
278
287
|
}
|
|
279
288
|
}
|
|
280
289
|
if (titleTemplateIdx !== -1) {
|
package/dist/index.mjs
CHANGED
|
@@ -204,6 +204,14 @@ function changeKeyCasingDeep(input) {
|
|
|
204
204
|
const tagWeight = (tag) => {
|
|
205
205
|
if (typeof tag.tagPriority === "number")
|
|
206
206
|
return tag.tagPriority;
|
|
207
|
+
switch (tag.tagPriority) {
|
|
208
|
+
case "critical":
|
|
209
|
+
return 2;
|
|
210
|
+
case "high":
|
|
211
|
+
return 9;
|
|
212
|
+
case "low":
|
|
213
|
+
return 12;
|
|
214
|
+
}
|
|
207
215
|
switch (tag.tag) {
|
|
208
216
|
case "base":
|
|
209
217
|
return -1;
|
|
@@ -254,7 +262,7 @@ const renderTitleTemplate = (template, title) => {
|
|
|
254
262
|
return template.replace("%s", title ?? "");
|
|
255
263
|
};
|
|
256
264
|
function resolveTitleTemplateFromTags(tags) {
|
|
257
|
-
|
|
265
|
+
let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
|
|
258
266
|
const titleIdx = tags.findIndex((i) => i.tag === "title");
|
|
259
267
|
if (titleIdx !== -1 && titleTemplateIdx !== -1) {
|
|
260
268
|
const newTitle = renderTitleTemplate(
|
|
@@ -273,6 +281,7 @@ function resolveTitleTemplateFromTags(tags) {
|
|
|
273
281
|
if (newTitle !== null) {
|
|
274
282
|
tags[titleTemplateIdx].children = newTitle;
|
|
275
283
|
tags[titleTemplateIdx].tag = "title";
|
|
284
|
+
titleTemplateIdx = -1;
|
|
276
285
|
}
|
|
277
286
|
}
|
|
278
287
|
if (titleTemplateIdx !== -1) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"packageManager": "pnpm@7.
|
|
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",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
"@unhead/
|
|
35
|
-
"
|
|
33
|
+
"hookable": "^5.4.2",
|
|
34
|
+
"@unhead/dom": "1.0.3",
|
|
35
|
+
"@unhead/schema": "1.0.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"zhead": "^1.0.
|
|
38
|
+
"zhead": "^1.0.4"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "unbuild .",
|