unhead 1.8.0 → 1.8.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 +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -197,7 +197,7 @@ const SupportedAttrs = {
|
|
|
197
197
|
link: "href",
|
|
198
198
|
htmlAttrs: "lang"
|
|
199
199
|
};
|
|
200
|
-
const TemplateParamsPlugin = shared.defineHeadPlugin({
|
|
200
|
+
const TemplateParamsPlugin = shared.defineHeadPlugin((head) => ({
|
|
201
201
|
hooks: {
|
|
202
202
|
"tags:resolve": (ctx) => {
|
|
203
203
|
const { tags } = ctx;
|
|
@@ -218,10 +218,12 @@ const TemplateParamsPlugin = shared.defineHeadPlugin({
|
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
+
head._templateParams = params;
|
|
222
|
+
head._separator = sep;
|
|
221
223
|
ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
|
-
});
|
|
226
|
+
}));
|
|
225
227
|
|
|
226
228
|
const TitleTemplatePlugin = shared.defineHeadPlugin({
|
|
227
229
|
hooks: {
|
|
@@ -490,9 +492,7 @@ function useScript(input, _options) {
|
|
|
490
492
|
function maybeHintEarlyConnection(rel) {
|
|
491
493
|
if (
|
|
492
494
|
// opt-out
|
|
493
|
-
options.skipEarlyConnections || //
|
|
494
|
-
!input.src.includes("//") || // must be server-side
|
|
495
|
-
!head.ssr
|
|
495
|
+
options.skipEarlyConnections || !input.src.includes("//") || !head.ssr
|
|
496
496
|
)
|
|
497
497
|
return;
|
|
498
498
|
const key2 = `use-script.${id}.early-connection`;
|
|
@@ -559,9 +559,9 @@ function useScript(input, _options) {
|
|
|
559
559
|
if (trigger) {
|
|
560
560
|
const isIdle = trigger === "idle";
|
|
561
561
|
if (isIdle) {
|
|
562
|
-
if (head.ssr)
|
|
562
|
+
if (head.ssr)
|
|
563
563
|
trigger = "manual";
|
|
564
|
-
|
|
564
|
+
else
|
|
565
565
|
trigger = new Promise((resolve) => requestIdleCallback(() => resolve()));
|
|
566
566
|
}
|
|
567
567
|
trigger === "manual" && (trigger = new Promise(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -196,7 +196,7 @@ const SupportedAttrs = {
|
|
|
196
196
|
link: "href",
|
|
197
197
|
htmlAttrs: "lang"
|
|
198
198
|
};
|
|
199
|
-
const TemplateParamsPlugin = defineHeadPlugin({
|
|
199
|
+
const TemplateParamsPlugin = defineHeadPlugin((head) => ({
|
|
200
200
|
hooks: {
|
|
201
201
|
"tags:resolve": (ctx) => {
|
|
202
202
|
const { tags } = ctx;
|
|
@@ -217,10 +217,12 @@ const TemplateParamsPlugin = defineHeadPlugin({
|
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
head._templateParams = params;
|
|
221
|
+
head._separator = sep;
|
|
220
222
|
ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
|
-
});
|
|
225
|
+
}));
|
|
224
226
|
|
|
225
227
|
const TitleTemplatePlugin = defineHeadPlugin({
|
|
226
228
|
hooks: {
|
|
@@ -489,9 +491,7 @@ function useScript(input, _options) {
|
|
|
489
491
|
function maybeHintEarlyConnection(rel) {
|
|
490
492
|
if (
|
|
491
493
|
// opt-out
|
|
492
|
-
options.skipEarlyConnections || //
|
|
493
|
-
!input.src.includes("//") || // must be server-side
|
|
494
|
-
!head.ssr
|
|
494
|
+
options.skipEarlyConnections || !input.src.includes("//") || !head.ssr
|
|
495
495
|
)
|
|
496
496
|
return;
|
|
497
497
|
const key2 = `use-script.${id}.early-connection`;
|
|
@@ -558,9 +558,9 @@ function useScript(input, _options) {
|
|
|
558
558
|
if (trigger) {
|
|
559
559
|
const isIdle = trigger === "idle";
|
|
560
560
|
if (isIdle) {
|
|
561
|
-
if (head.ssr)
|
|
561
|
+
if (head.ssr)
|
|
562
562
|
trigger = "manual";
|
|
563
|
-
|
|
563
|
+
else
|
|
564
564
|
trigger = new Promise((resolve) => requestIdleCallback(() => resolve()));
|
|
565
565
|
}
|
|
566
566
|
trigger === "manual" && (trigger = new Promise(() => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.2",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"hookable": "^5.5.3",
|
|
33
|
-
"@unhead/dom": "1.8.
|
|
34
|
-
"@unhead/schema": "1.8.
|
|
35
|
-
"@unhead/shared": "1.8.
|
|
33
|
+
"@unhead/dom": "1.8.2",
|
|
34
|
+
"@unhead/schema": "1.8.2",
|
|
35
|
+
"@unhead/shared": "1.8.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "unbuild .",
|