unhead 1.0.0 → 1.0.2
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 -18
- package/dist/index.mjs +10 -18
- package/package.json +4 -4
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;
|
|
@@ -226,23 +234,7 @@ const sortTags = (aTag, bTag) => {
|
|
|
226
234
|
};
|
|
227
235
|
|
|
228
236
|
const UniqueTags = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
229
|
-
|
|
230
|
-
"og:image",
|
|
231
|
-
"og:video",
|
|
232
|
-
"og:audio",
|
|
233
|
-
"og:locale:alternate",
|
|
234
|
-
"video:actor",
|
|
235
|
-
"video:director",
|
|
236
|
-
"video:writer",
|
|
237
|
-
"video:tag",
|
|
238
|
-
"article:author",
|
|
239
|
-
"article:tag",
|
|
240
|
-
"book:tag",
|
|
241
|
-
"book:author",
|
|
242
|
-
"music:album",
|
|
243
|
-
"music:musician"
|
|
244
|
-
];
|
|
245
|
-
function tagDedupeKey(tag) {
|
|
237
|
+
function tagDedupeKey(tag, fn) {
|
|
246
238
|
const { props, tag: tagName } = tag;
|
|
247
239
|
if (UniqueTags.includes(tagName))
|
|
248
240
|
return tagName;
|
|
@@ -256,7 +248,7 @@ function tagDedupeKey(tag) {
|
|
|
256
248
|
for (const n of name) {
|
|
257
249
|
if (typeof props[n] !== "undefined") {
|
|
258
250
|
const val = String(props[n]);
|
|
259
|
-
if (
|
|
251
|
+
if (fn && !fn(val))
|
|
260
252
|
return false;
|
|
261
253
|
return `${tagName}:${n}:${val}`;
|
|
262
254
|
}
|
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;
|
|
@@ -224,23 +232,7 @@ const sortTags = (aTag, bTag) => {
|
|
|
224
232
|
};
|
|
225
233
|
|
|
226
234
|
const UniqueTags = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
227
|
-
|
|
228
|
-
"og:image",
|
|
229
|
-
"og:video",
|
|
230
|
-
"og:audio",
|
|
231
|
-
"og:locale:alternate",
|
|
232
|
-
"video:actor",
|
|
233
|
-
"video:director",
|
|
234
|
-
"video:writer",
|
|
235
|
-
"video:tag",
|
|
236
|
-
"article:author",
|
|
237
|
-
"article:tag",
|
|
238
|
-
"book:tag",
|
|
239
|
-
"book:author",
|
|
240
|
-
"music:album",
|
|
241
|
-
"music:musician"
|
|
242
|
-
];
|
|
243
|
-
function tagDedupeKey(tag) {
|
|
235
|
+
function tagDedupeKey(tag, fn) {
|
|
244
236
|
const { props, tag: tagName } = tag;
|
|
245
237
|
if (UniqueTags.includes(tagName))
|
|
246
238
|
return tagName;
|
|
@@ -254,7 +246,7 @@ function tagDedupeKey(tag) {
|
|
|
254
246
|
for (const n of name) {
|
|
255
247
|
if (typeof props[n] !== "undefined") {
|
|
256
248
|
const val = String(props[n]);
|
|
257
|
-
if (
|
|
249
|
+
if (fn && !fn(val))
|
|
258
250
|
return false;
|
|
259
251
|
return `${tagName}:${n}:${val}`;
|
|
260
252
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"packageManager": "pnpm@7.14.0",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@unhead/dom": "1.0.
|
|
34
|
-
"@unhead/schema": "1.0.
|
|
33
|
+
"@unhead/dom": "1.0.2",
|
|
34
|
+
"@unhead/schema": "1.0.2",
|
|
35
35
|
"hookable": "^5.4.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"zhead": "^1.0.
|
|
38
|
+
"zhead": "^1.0.3"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "unbuild .",
|