@unhead/addons 1.0.15 → 1.0.17

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 CHANGED
@@ -10,12 +10,14 @@ const InferSeoMetaPlugin = (options) => {
10
10
  hooks: {
11
11
  entries: {
12
12
  resolve({ entries }) {
13
+ let hasOgImage = false;
13
14
  for (const entry of entries) {
14
15
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
15
16
  const input = entry[inputKey];
16
17
  const resolvedMeta = input.meta || [];
17
18
  const title = input.title;
18
19
  const ogTitle = resolvedMeta.find((meta) => meta.property === "og:title");
20
+ hasOgImage = hasOgImage || !!resolvedMeta.find((meta) => meta.property === "og:image");
19
21
  const description = resolvedMeta.find((meta) => meta.name === "description")?.content;
20
22
  const ogDescription = resolvedMeta.find((meta) => meta.property === "og:description");
21
23
  entry[inputKey].meta = input.meta || [];
@@ -40,7 +42,7 @@ const InferSeoMetaPlugin = (options) => {
40
42
  content: options?.robots || "max-snippet: -1; max-image-preview: large; max-video-preview: -1"
41
43
  });
42
44
  }
43
- if (options?.twitterCard !== false) {
45
+ if (hasOgImage && options?.twitterCard !== false) {
44
46
  metas.push({
45
47
  property: "twitter:card",
46
48
  content: options?.twitterCard || "summary_large_image"
package/dist/index.mjs CHANGED
@@ -8,12 +8,14 @@ const InferSeoMetaPlugin = (options) => {
8
8
  hooks: {
9
9
  entries: {
10
10
  resolve({ entries }) {
11
+ let hasOgImage = false;
11
12
  for (const entry of entries) {
12
13
  const inputKey = entry.resolvedInput ? "resolvedInput" : "input";
13
14
  const input = entry[inputKey];
14
15
  const resolvedMeta = input.meta || [];
15
16
  const title = input.title;
16
17
  const ogTitle = resolvedMeta.find((meta) => meta.property === "og:title");
18
+ hasOgImage = hasOgImage || !!resolvedMeta.find((meta) => meta.property === "og:image");
17
19
  const description = resolvedMeta.find((meta) => meta.name === "description")?.content;
18
20
  const ogDescription = resolvedMeta.find((meta) => meta.property === "og:description");
19
21
  entry[inputKey].meta = input.meta || [];
@@ -38,7 +40,7 @@ const InferSeoMetaPlugin = (options) => {
38
40
  content: options?.robots || "max-snippet: -1; max-image-preview: large; max-video-preview: -1"
39
41
  });
40
42
  }
41
- if (options?.twitterCard !== false) {
43
+ if (hasOgImage && options?.twitterCard !== false) {
42
44
  metas.push({
43
45
  property: "twitter:card",
44
46
  content: options?.twitterCard || "summary_large_image"
@@ -39,6 +39,7 @@ const TreeshakeServerComposables = createUnplugin((userConfig = {}) => {
39
39
  RemoveFunctions([
40
40
  "useServerHead",
41
41
  "useSeoMeta",
42
+ // plugins
42
43
  "useSchemaOrg"
43
44
  ])
44
45
  ]
@@ -41,6 +41,7 @@ const TreeshakeServerComposables = unplugin.createUnplugin((userConfig = {}) =>
41
41
  RemoveFunctions([
42
42
  "useServerHead",
43
43
  "useSeoMeta",
44
+ // plugins
44
45
  "useSchemaOrg"
45
46
  ])
46
47
  ]
package/dist/vite.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const TreeshakeServerComposables = require('./shared/addons.b02ddeeb.cjs');
3
+ const TreeshakeServerComposables = require('./shared/addons.c0c549fb.cjs');
4
4
  require('unplugin');
5
5
  require('@rollup/pluginutils');
6
6
  require('unplugin-ast');
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { T as TreeshakeServerComposables } from './shared/addons.d2b16a33.mjs';
1
+ import { T as TreeshakeServerComposables } from './shared/addons.6d6f9a48.mjs';
2
2
  import 'unplugin';
3
3
  import '@rollup/pluginutils';
4
4
  import 'unplugin-ast';
package/dist/webpack.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const TreeshakeServerComposables = require('./shared/addons.b02ddeeb.cjs');
3
+ const TreeshakeServerComposables = require('./shared/addons.c0c549fb.cjs');
4
4
  require('unplugin');
5
5
  require('@rollup/pluginutils');
6
6
  require('unplugin-ast');
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { T as TreeshakeServerComposables } from './shared/addons.d2b16a33.mjs';
1
+ import { T as TreeshakeServerComposables } from './shared/addons.6d6f9a48.mjs';
2
2
  import 'unplugin';
3
3
  import '@rollup/pluginutils';
4
4
  import 'unplugin-ast';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/addons",
3
3
  "type": "module",
4
- "version": "1.0.15",
5
- "packageManager": "pnpm@7.23.0",
4
+ "version": "1.0.17",
5
+ "packageManager": "pnpm@7.25.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -53,8 +53,8 @@
53
53
  "@rollup/pluginutils": "^5.0.2",
54
54
  "unplugin": "^1.0.1",
55
55
  "unplugin-ast": "^0.6.0",
56
- "@unhead/schema": "1.0.15",
57
- "unhead": "1.0.15"
56
+ "@unhead/schema": "1.0.17",
57
+ "unhead": "1.0.17"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@babel/types": "^7.20.7",