@devite/nuxt-sanity 2.8.0 → 2.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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "configKey": "sanity",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { defineNuxtModule, createResolver, addPlugin, addServerHandler, addImpor
3
3
  import defu from 'defu';
4
4
 
5
5
  const name = "@devite/nuxt-sanity";
6
- const version = "2.8.0";
6
+ const version = "2.8.2";
7
7
 
8
8
  const CONFIG_KEY = "sanity";
9
9
  const module = defineNuxtModule({
@@ -59,7 +59,7 @@ const module = defineNuxtModule({
59
59
  `${name} > @sanity/visual-editing > react/jsx-runtime`,
60
60
  `${name} > @sanity/visual-editing > react-dom`,
61
61
  `${name} > @sanity/visual-editing > react-dom/client`,
62
- `${name} > @sanity/visual-editing > react-compiler-runtime`,
62
+ // `${name} > @sanity/visual-editing > react-compiler-runtime`,
63
63
  "@sanity/client"
64
64
  ]
65
65
  });
@@ -135,11 +135,15 @@ const module = defineNuxtModule({
135
135
  enabled: true,
136
136
  studioUrl: moduleConfig.visualEditing.studioUrl
137
137
  } || {},
138
- visualEditing: {
139
- ...moduleConfig.visualEditing,
140
- token: void 0
141
- }
138
+ visualEditing: moduleConfig.visualEditing
142
139
  });
140
+ const publicSanityConfig = $config.public.sanity;
141
+ if (publicSanityConfig.visualEditing) {
142
+ delete publicSanityConfig.visualEditing.token;
143
+ }
144
+ if (publicSanityConfig.minimalClient && publicSanityConfig.minimalClient !== true) {
145
+ delete publicSanityConfig.minimalClient.webhookSecret;
146
+ }
143
147
  addImportsDir(resolve("runtime/client"));
144
148
  addImports(
145
149
  [
@@ -48,16 +48,11 @@ const image: ComputedRef<ImageAsset | undefined> = computed(
48
48
  )
49
49
  const imageUrl = computed(() => image.value?.url)
50
50
  const imageDimensions = computed(() => image.value?.metadata.dimensions)
51
+ const imageMimeType = computed(() => image.value?.mimeType as 'image/gif' | 'image/jpeg' | 'image/png' | undefined)
52
+ const imageAlt = computed(() => image.value?.altText as string | undefined)
51
53
 
52
54
  useHead({
53
55
  meta: [
54
- { name: 'site_name', content: () => globalSEO.value?.siteName },
55
- { name: 'og:image', content: () => imageUrl.value },
56
- { name: 'og:image:width', content: () => imageDimensions.value?.width },
57
- { name: 'og:image:height', content: () => imageDimensions.value?.height },
58
- { name: 'twitter:image', content: () => imageUrl.value },
59
- { name: 'twitter:image:width', content: () => imageDimensions.value?.width },
60
- { name: 'twitter:image:height', content: () => imageDimensions.value?.height },
61
56
  { name: 'og:url', content: () => url.value },
62
57
  { name: 'twitter:url', content: () => url.value },
63
58
  ],
@@ -65,12 +60,26 @@ useHead({
65
60
  })
66
61
 
67
62
  useSeoMeta({
63
+ // indexing
68
64
  robots: () => `${seo.value?.indexable ? '' : 'no'}index,follow`,
65
+ // title
69
66
  title: () => seo.value?.title || '',
70
- description: () => seo.value?.description,
71
67
  ogTitle: () => seo.value?.shortTitle,
72
- ogDescription: () => seo.value?.description,
73
68
  twitterTitle: () => seo.value?.shortTitle,
69
+ // description
70
+ description: () => seo.value?.description,
71
+ ogDescription: () => seo.value?.description,
74
72
  twitterDescription: () => seo.value?.description,
73
+ // OpenGraph site name
74
+ ogSiteName: () => globalSEO.value?.siteName,
75
+ // OpenGraph Image
76
+ ogImage: () => imageUrl.value,
77
+ ogImageWidth: () => imageDimensions.value?.width,
78
+ ogImageHeight: () => imageDimensions.value?.height,
79
+ ogImageType: () => imageMimeType.value,
80
+ ogImageAlt: () => imageAlt.value,
81
+ // Twitter Image
82
+ twitterImage: () => imageUrl.value,
83
+ twitterImageAlt: () => imageAlt.value,
75
84
  })
76
85
  </script>
@@ -11,7 +11,7 @@ export default defineNuxtPlugin(async () => {
11
11
  const previewModeCookie = useCookie("__sanity_preview");
12
12
  visualEditingState.enabled = previewModeId === previewModeCookie.value;
13
13
  }
14
- } else if (visualEditingState.enabled && visualEditing?.mode !== "custom") {
14
+ } else if (visualEditingState.enabled) {
15
15
  switch (visualEditing?.mode) {
16
16
  case "live-visual-editing":
17
17
  case "visual-editing":
@@ -1,6 +1,7 @@
1
1
  import { validatePreviewUrl } from "@sanity/preview-url-secret";
2
2
  import { createError, defineEventHandler, getRequestURL, sendRedirect, setCookie } from "h3";
3
3
  import useSanityClient from "../../utils/useSanityClient.js";
4
+ import { useRuntimeConfig } from "#imports";
4
5
  export default defineEventHandler(async (event) => {
5
6
  const client = useSanityClient("default");
6
7
  const { isValid, redirectTo = "/" } = await validatePreviewUrl(client.client, getRequestURL(event).toString());
@@ -10,10 +11,11 @@ export default defineEventHandler(async (event) => {
10
11
  statusMessage: "Invalid secret"
11
12
  });
12
13
  }
14
+ const secure = useRuntimeConfig().public.baseUrl?.startsWith("https://") || false;
13
15
  setCookie(event, "__sanity_preview", client.config.visualEditing.previewModeId || "", {
14
16
  httpOnly: true,
15
- sameSite: !import.meta.dev ? "none" : "lax",
16
- secure: !import.meta.dev,
17
+ sameSite: secure ? "none" : "lax",
18
+ secure,
17
19
  path: "/"
18
20
  });
19
21
  await sendRedirect(event, redirectTo, 307);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Advanced Sanity integration for Nuxt.js.",
5
5
  "repository": "devite-io/nuxt-sanity",
6
6
  "license": "MIT",
@@ -25,10 +25,10 @@
25
25
  "@nuxt/image": "^1.8.1",
26
26
  "@portabletext/vue": "^1.0.11",
27
27
  "@sanity/client": "^6.24.1",
28
- "@sanity/core-loader": "^1.7.22",
28
+ "@sanity/core-loader": "^1.7.23",
29
29
  "@sanity/preview-url-secret": "^2.0.5",
30
30
  "@sanity/types": "^3.68.3",
31
- "@sanity/visual-editing": "^2.11.3",
31
+ "@sanity/visual-editing": "^2.11.5",
32
32
  "defu": "^6.1.4",
33
33
  "ofetch": "^1.4.1",
34
34
  "ohash": "^1.1.4",