@unhead/vue 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 +12 -36
- package/dist/index.mjs +12 -36
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -14,23 +14,7 @@ const HasElementTags$1 = [
|
|
|
14
14
|
];
|
|
15
15
|
|
|
16
16
|
const UniqueTags$1 = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
17
|
-
|
|
18
|
-
"og:image",
|
|
19
|
-
"og:video",
|
|
20
|
-
"og:audio",
|
|
21
|
-
"og:locale:alternate",
|
|
22
|
-
"video:actor",
|
|
23
|
-
"video:director",
|
|
24
|
-
"video:writer",
|
|
25
|
-
"video:tag",
|
|
26
|
-
"article:author",
|
|
27
|
-
"article:tag",
|
|
28
|
-
"book:tag",
|
|
29
|
-
"book:author",
|
|
30
|
-
"music:album",
|
|
31
|
-
"music:musician"
|
|
32
|
-
];
|
|
33
|
-
function tagDedupeKey$1(tag) {
|
|
17
|
+
function tagDedupeKey$1(tag, fn) {
|
|
34
18
|
const { props, tag: tagName } = tag;
|
|
35
19
|
if (UniqueTags$1.includes(tagName))
|
|
36
20
|
return tagName;
|
|
@@ -44,7 +28,7 @@ function tagDedupeKey$1(tag) {
|
|
|
44
28
|
for (const n of name) {
|
|
45
29
|
if (typeof props[n] !== "undefined") {
|
|
46
30
|
const val = String(props[n]);
|
|
47
|
-
if (
|
|
31
|
+
if (fn && !fn(val))
|
|
48
32
|
return false;
|
|
49
33
|
return `${tagName}:${n}:${val}`;
|
|
50
34
|
}
|
|
@@ -282,6 +266,14 @@ async function normaliseProps(props) {
|
|
|
282
266
|
const tagWeight = (tag) => {
|
|
283
267
|
if (typeof tag.tagPriority === "number")
|
|
284
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
|
+
}
|
|
285
277
|
switch (tag.tag) {
|
|
286
278
|
case "base":
|
|
287
279
|
return -1;
|
|
@@ -302,23 +294,7 @@ const sortTags = (aTag, bTag) => {
|
|
|
302
294
|
};
|
|
303
295
|
|
|
304
296
|
const UniqueTags = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
305
|
-
|
|
306
|
-
"og:image",
|
|
307
|
-
"og:video",
|
|
308
|
-
"og:audio",
|
|
309
|
-
"og:locale:alternate",
|
|
310
|
-
"video:actor",
|
|
311
|
-
"video:director",
|
|
312
|
-
"video:writer",
|
|
313
|
-
"video:tag",
|
|
314
|
-
"article:author",
|
|
315
|
-
"article:tag",
|
|
316
|
-
"book:tag",
|
|
317
|
-
"book:author",
|
|
318
|
-
"music:album",
|
|
319
|
-
"music:musician"
|
|
320
|
-
];
|
|
321
|
-
function tagDedupeKey(tag) {
|
|
297
|
+
function tagDedupeKey(tag, fn) {
|
|
322
298
|
const { props, tag: tagName } = tag;
|
|
323
299
|
if (UniqueTags.includes(tagName))
|
|
324
300
|
return tagName;
|
|
@@ -332,7 +308,7 @@ function tagDedupeKey(tag) {
|
|
|
332
308
|
for (const n of name) {
|
|
333
309
|
if (typeof props[n] !== "undefined") {
|
|
334
310
|
const val = String(props[n]);
|
|
335
|
-
if (
|
|
311
|
+
if (fn && !fn(val))
|
|
336
312
|
return false;
|
|
337
313
|
return `${tagName}:${n}:${val}`;
|
|
338
314
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -12,23 +12,7 @@ const HasElementTags$1 = [
|
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
const UniqueTags$1 = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
15
|
-
|
|
16
|
-
"og:image",
|
|
17
|
-
"og:video",
|
|
18
|
-
"og:audio",
|
|
19
|
-
"og:locale:alternate",
|
|
20
|
-
"video:actor",
|
|
21
|
-
"video:director",
|
|
22
|
-
"video:writer",
|
|
23
|
-
"video:tag",
|
|
24
|
-
"article:author",
|
|
25
|
-
"article:tag",
|
|
26
|
-
"book:tag",
|
|
27
|
-
"book:author",
|
|
28
|
-
"music:album",
|
|
29
|
-
"music:musician"
|
|
30
|
-
];
|
|
31
|
-
function tagDedupeKey$1(tag) {
|
|
15
|
+
function tagDedupeKey$1(tag, fn) {
|
|
32
16
|
const { props, tag: tagName } = tag;
|
|
33
17
|
if (UniqueTags$1.includes(tagName))
|
|
34
18
|
return tagName;
|
|
@@ -42,7 +26,7 @@ function tagDedupeKey$1(tag) {
|
|
|
42
26
|
for (const n of name) {
|
|
43
27
|
if (typeof props[n] !== "undefined") {
|
|
44
28
|
const val = String(props[n]);
|
|
45
|
-
if (
|
|
29
|
+
if (fn && !fn(val))
|
|
46
30
|
return false;
|
|
47
31
|
return `${tagName}:${n}:${val}`;
|
|
48
32
|
}
|
|
@@ -280,6 +264,14 @@ async function normaliseProps(props) {
|
|
|
280
264
|
const tagWeight = (tag) => {
|
|
281
265
|
if (typeof tag.tagPriority === "number")
|
|
282
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
|
+
}
|
|
283
275
|
switch (tag.tag) {
|
|
284
276
|
case "base":
|
|
285
277
|
return -1;
|
|
@@ -300,23 +292,7 @@ const sortTags = (aTag, bTag) => {
|
|
|
300
292
|
};
|
|
301
293
|
|
|
302
294
|
const UniqueTags = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs"];
|
|
303
|
-
|
|
304
|
-
"og:image",
|
|
305
|
-
"og:video",
|
|
306
|
-
"og:audio",
|
|
307
|
-
"og:locale:alternate",
|
|
308
|
-
"video:actor",
|
|
309
|
-
"video:director",
|
|
310
|
-
"video:writer",
|
|
311
|
-
"video:tag",
|
|
312
|
-
"article:author",
|
|
313
|
-
"article:tag",
|
|
314
|
-
"book:tag",
|
|
315
|
-
"book:author",
|
|
316
|
-
"music:album",
|
|
317
|
-
"music:musician"
|
|
318
|
-
];
|
|
319
|
-
function tagDedupeKey(tag) {
|
|
295
|
+
function tagDedupeKey(tag, fn) {
|
|
320
296
|
const { props, tag: tagName } = tag;
|
|
321
297
|
if (UniqueTags.includes(tagName))
|
|
322
298
|
return tagName;
|
|
@@ -330,7 +306,7 @@ function tagDedupeKey(tag) {
|
|
|
330
306
|
for (const n of name) {
|
|
331
307
|
if (typeof props[n] !== "undefined") {
|
|
332
308
|
const val = String(props[n]);
|
|
333
|
-
if (
|
|
309
|
+
if (fn && !fn(val))
|
|
334
310
|
return false;
|
|
335
311
|
return `${tagName}:${n}:${val}`;
|
|
336
312
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
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",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"vue": ">=2.7 || >=3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unhead/schema": "1.0.
|
|
36
|
+
"@unhead/schema": "1.0.2",
|
|
37
37
|
"hookable": "^5.4.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"unhead": "1.0.
|
|
40
|
+
"unhead": "1.0.2",
|
|
41
41
|
"vue": "^3.2.45"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|