@unhead/addons 1.1.2 → 1.1.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.
|
@@ -32,8 +32,9 @@ const TreeshakeServerComposables = unplugin.createUnplugin(() => {
|
|
|
32
32
|
return false;
|
|
33
33
|
},
|
|
34
34
|
async transform(code, id) {
|
|
35
|
-
if (!code.includes("useServerHead") && !code.includes("useServerHeadSafe") && !code.includes("useServerSeoMeta") && !code.includes("useSchemaOrg"))
|
|
36
|
-
return
|
|
35
|
+
if (!code.includes("useServerHead") && !code.includes("useServerHeadSafe") && !code.includes("useServerSeoMeta") && !code.includes("useSchemaOrg")) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
37
38
|
let transformed;
|
|
38
39
|
try {
|
|
39
40
|
transformed = await unpluginAst.transform(code, id, {
|
|
@@ -53,12 +54,12 @@ const TreeshakeServerComposables = unplugin.createUnplugin(() => {
|
|
|
53
54
|
return transformed;
|
|
54
55
|
},
|
|
55
56
|
webpack(ctx) {
|
|
56
|
-
if (ctx.name
|
|
57
|
+
if (ctx.name === "server")
|
|
57
58
|
;
|
|
58
59
|
},
|
|
59
60
|
vite: {
|
|
60
61
|
apply(config, env) {
|
|
61
|
-
if (
|
|
62
|
+
if (env.ssrBuild) {
|
|
62
63
|
return true;
|
|
63
64
|
}
|
|
64
65
|
return false;
|
|
@@ -113,7 +114,7 @@ const UseSeoMetaTransform = unplugin.createUnplugin(() => {
|
|
|
113
114
|
...importNames
|
|
114
115
|
}).includes(_node.callee.name)) {
|
|
115
116
|
const node = _node;
|
|
116
|
-
const calleeName = importNames[node.callee.name];
|
|
117
|
+
const calleeName = importNames[node.callee.name] || node.callee.name;
|
|
117
118
|
const properties = node.arguments[0].properties;
|
|
118
119
|
if (!properties)
|
|
119
120
|
return;
|
|
@@ -171,7 +172,7 @@ const UseSeoMetaTransform = unplugin.createUnplugin(() => {
|
|
|
171
172
|
if (output) {
|
|
172
173
|
if (meta.length)
|
|
173
174
|
output.push(" ]");
|
|
174
|
-
output.push("})
|
|
175
|
+
output.push("})");
|
|
175
176
|
s.overwrite(node.start, node.end, output.join("\n"));
|
|
176
177
|
}
|
|
177
178
|
}
|
|
@@ -30,8 +30,9 @@ const TreeshakeServerComposables = createUnplugin(() => {
|
|
|
30
30
|
return false;
|
|
31
31
|
},
|
|
32
32
|
async transform(code, id) {
|
|
33
|
-
if (!code.includes("useServerHead") && !code.includes("useServerHeadSafe") && !code.includes("useServerSeoMeta") && !code.includes("useSchemaOrg"))
|
|
34
|
-
return
|
|
33
|
+
if (!code.includes("useServerHead") && !code.includes("useServerHeadSafe") && !code.includes("useServerSeoMeta") && !code.includes("useSchemaOrg")) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
35
36
|
let transformed;
|
|
36
37
|
try {
|
|
37
38
|
transformed = await transform(code, id, {
|
|
@@ -51,12 +52,12 @@ const TreeshakeServerComposables = createUnplugin(() => {
|
|
|
51
52
|
return transformed;
|
|
52
53
|
},
|
|
53
54
|
webpack(ctx) {
|
|
54
|
-
if (ctx.name
|
|
55
|
+
if (ctx.name === "server")
|
|
55
56
|
;
|
|
56
57
|
},
|
|
57
58
|
vite: {
|
|
58
59
|
apply(config, env) {
|
|
59
|
-
if (
|
|
60
|
+
if (env.ssrBuild) {
|
|
60
61
|
return true;
|
|
61
62
|
}
|
|
62
63
|
return false;
|
|
@@ -111,7 +112,7 @@ const UseSeoMetaTransform = createUnplugin(() => {
|
|
|
111
112
|
...importNames
|
|
112
113
|
}).includes(_node.callee.name)) {
|
|
113
114
|
const node = _node;
|
|
114
|
-
const calleeName = importNames[node.callee.name];
|
|
115
|
+
const calleeName = importNames[node.callee.name] || node.callee.name;
|
|
115
116
|
const properties = node.arguments[0].properties;
|
|
116
117
|
if (!properties)
|
|
117
118
|
return;
|
|
@@ -169,7 +170,7 @@ const UseSeoMetaTransform = createUnplugin(() => {
|
|
|
169
170
|
if (output) {
|
|
170
171
|
if (meta.length)
|
|
171
172
|
output.push(" ]");
|
|
172
|
-
output.push("})
|
|
173
|
+
output.push("})");
|
|
173
174
|
s.overwrite(node.start, node.end, output.join("\n"));
|
|
174
175
|
}
|
|
175
176
|
}
|
package/dist/vite.cjs
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform } from './shared/addons.
|
|
1
|
+
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform } from './shared/addons.687f69d7.mjs';
|
|
2
2
|
import 'node:url';
|
|
3
3
|
import 'unplugin';
|
|
4
4
|
import 'unplugin-ast';
|
package/dist/webpack.cjs
CHANGED
package/dist/webpack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform } from './shared/addons.
|
|
1
|
+
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform } from './shared/addons.687f69d7.mjs';
|
|
2
2
|
import 'node:url';
|
|
3
3
|
import 'unplugin';
|
|
4
4
|
import 'unplugin-ast';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/addons",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"packageManager": "pnpm@7.27.1",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"ufo": "^1.1.0",
|
|
58
58
|
"unplugin": "^1.1.0",
|
|
59
59
|
"unplugin-ast": "^0.7.0",
|
|
60
|
-
"@unhead/schema": "1.1.
|
|
61
|
-
"@unhead/shared": "1.1.
|
|
62
|
-
"unhead": "1.1.
|
|
60
|
+
"@unhead/schema": "1.1.3",
|
|
61
|
+
"@unhead/shared": "1.1.3",
|
|
62
|
+
"unhead": "1.1.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@babel/types": "^7.21.0"
|