unhead 0.4.3 → 0.4.5
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 +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -390,6 +390,8 @@ const DeprecatedTagAttrPlugin = () => {
|
|
|
390
390
|
});
|
|
391
391
|
};
|
|
392
392
|
|
|
393
|
+
const IsBrowser = typeof window !== "undefined";
|
|
394
|
+
|
|
393
395
|
function hashCode(s) {
|
|
394
396
|
let h = 9;
|
|
395
397
|
for (let i = 0; i < s.length; )
|
|
@@ -404,7 +406,8 @@ const HydrateStateFromSSRPlugin = () => {
|
|
|
404
406
|
if (!HasElementTags.includes(tag.tag) || typeof tag._d === "undefined")
|
|
405
407
|
return;
|
|
406
408
|
tag._s = `data-h-${hashCode(tag._d)}`;
|
|
407
|
-
|
|
409
|
+
const isBrowser = IsBrowser || getActiveHead()?.resolvedOptions?.document;
|
|
410
|
+
if (!isBrowser && (entry._m === "server" || tag.key))
|
|
408
411
|
tag.props[tag._s] = "";
|
|
409
412
|
}
|
|
410
413
|
}
|
|
@@ -478,8 +481,6 @@ function asArray(value) {
|
|
|
478
481
|
return Array.isArray(value) ? value : [value];
|
|
479
482
|
}
|
|
480
483
|
|
|
481
|
-
const IsBrowser = typeof window !== "undefined";
|
|
482
|
-
|
|
483
484
|
exports.activeHead = void 0;
|
|
484
485
|
const setActiveHead = (head) => exports.activeHead = head;
|
|
485
486
|
const getActiveHead = () => exports.activeHead;
|
package/dist/index.mjs
CHANGED
|
@@ -388,6 +388,8 @@ const DeprecatedTagAttrPlugin = () => {
|
|
|
388
388
|
});
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
+
const IsBrowser = typeof window !== "undefined";
|
|
392
|
+
|
|
391
393
|
function hashCode(s) {
|
|
392
394
|
let h = 9;
|
|
393
395
|
for (let i = 0; i < s.length; )
|
|
@@ -402,7 +404,8 @@ const HydrateStateFromSSRPlugin = () => {
|
|
|
402
404
|
if (!HasElementTags.includes(tag.tag) || typeof tag._d === "undefined")
|
|
403
405
|
return;
|
|
404
406
|
tag._s = `data-h-${hashCode(tag._d)}`;
|
|
405
|
-
|
|
407
|
+
const isBrowser = IsBrowser || getActiveHead()?.resolvedOptions?.document;
|
|
408
|
+
if (!isBrowser && (entry._m === "server" || tag.key))
|
|
406
409
|
tag.props[tag._s] = "";
|
|
407
410
|
}
|
|
408
411
|
}
|
|
@@ -476,8 +479,6 @@ function asArray(value) {
|
|
|
476
479
|
return Array.isArray(value) ? value : [value];
|
|
477
480
|
}
|
|
478
481
|
|
|
479
|
-
const IsBrowser = typeof window !== "undefined";
|
|
480
|
-
|
|
481
482
|
let activeHead;
|
|
482
483
|
const setActiveHead = (head) => activeHead = head;
|
|
483
484
|
const getActiveHead = () => activeHead;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.5",
|
|
5
5
|
"packageManager": "pnpm@7.14.0",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@unhead/dom": "0.4.
|
|
34
|
-
"@unhead/schema": "0.4.
|
|
33
|
+
"@unhead/dom": "0.4.5",
|
|
34
|
+
"@unhead/schema": "0.4.5",
|
|
35
35
|
"hookable": "^5.4.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|