@devite/nuxt-sanity 2.12.0 → 2.12.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.12.0",
3
+ "version": "2.12.2",
4
4
  "configKey": "sanity",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
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.12.0";
6
+ const version = "2.12.2";
7
7
 
8
8
  const CONFIG_KEY = "sanity";
9
9
  const module = defineNuxtModule({
@@ -1,6 +1,6 @@
1
- import { type ClientPerspective, type QueryParams, type SanityClient as SanityClientType } from '@sanity/client';
1
+ import type { ClientPerspective, QueryParams, SanityClient as SanityClientType } from '@sanity/client';
2
2
  import type { ModuleOptions } from '@devite/nuxt-sanity';
3
- import { type QueryStore } from '@sanity/core-loader';
3
+ import type { QueryStore } from '@sanity/core-loader';
4
4
  import { SanityClient } from '#imports';
5
5
  declare class DefaultSanityClient extends SanityClient {
6
6
  readonly client: SanityClientType;
@@ -1,6 +1,4 @@
1
- import {
2
- createClient
3
- } from "@sanity/client";
1
+ import { createClient } from "@sanity/client";
4
2
  import { createQueryStore as createCoreQueryStore } from "@sanity/core-loader";
5
3
  import { SanityClient } from "#imports";
6
4
  class DefaultSanityClient extends SanityClient {
@@ -1,20 +1,20 @@
1
1
  <template>
2
- <component
3
- :is="component"
4
- v-if="data"
5
- ref="componentRef"
6
- v-bind="{ ...$props, ...$attrs }"
7
- >
8
- <template
9
- v-for="(_, slotName) in $slots"
10
- #[slotName]="slotProps"
11
- >
12
- <slot
13
- :name="slotName"
14
- v-bind="slotProps ?? {}"
15
- />
16
- </template>
17
- </component>
2
+ <component
3
+ :is="component"
4
+ v-if="data"
5
+ ref="componentRef"
6
+ v-bind="{ ...$props, ...$attrs }"
7
+ >
8
+ <template
9
+ v-for="(_, slotName) in $slots"
10
+ #[slotName]="slotProps"
11
+ >
12
+ <slot
13
+ :name="slotName"
14
+ v-bind="slotProps ?? {}"
15
+ />
16
+ </template>
17
+ </component>
18
18
  </template>
19
19
 
20
20
  <script setup>
@@ -1,4 +1,4 @@
1
- import { type Component } from 'vue';
1
+ import type { Component } from 'vue';
2
2
  import type { SanityModule } from '@devite/nuxt-sanity';
3
3
  type __VLS_Props = {
4
4
  data?: SanityModule | Array<SanityModule>;
@@ -16,7 +16,7 @@ import { groq, IMAGE_WITHOUT_PREVIEW_PROJECTION, useRequestEvent, useRoute, useR
16
16
  const path = useRoute().path;
17
17
  const groqFilter = path === "/" ? '_type == "home"' : `_type == "page" && slug.current == $slug`;
18
18
  const { data: sanityData } = await useSanityQuery(
19
- groq`*[(${groqFilter}) || _type == "notFound"][0] { _id, _type, title, modules, seo { _type, indexable, title, shortTitle, description, image ${IMAGE_WITHOUT_PREVIEW_PROJECTION} } }`,
19
+ groq`*[(${groqFilter}) || _type == "notFound"][0] { _id, _type, slug, title, modules, seo { _type, indexable, title, shortTitle, description, image ${IMAGE_WITHOUT_PREVIEW_PROJECTION} } }`,
20
20
  { slug: path.substring(1) }
21
21
  );
22
22
  if (sanityData.value?._type === "notFound" && import.meta.server) {
@@ -27,7 +27,7 @@ if (sanityData.value?._type === "notFound" && import.meta.server) {
27
27
  const { baseUrl } = useRuntimeConfig().public;
28
28
  const seo = computed(() => sanityData.value?.seo);
29
29
  useSanitySEO(
30
- (baseUrl || "") + (sanityData.value && ("slug" in sanityData.value ? sanityData.value.slug.current : null) || "/"),
30
+ (baseUrl || "") + "/" + (sanityData.value && "slug" in sanityData.value && sanityData.value.slug?.current ? sanityData.value.slug.current : ""),
31
31
  seo
32
32
  );
33
33
  </script>
@@ -9,7 +9,7 @@
9
9
  :alt="imageAsset.altText"
10
10
  :placeholder="loading === 'eager' || !lqip ? void 0 : imageAsset.metadata.lqip"
11
11
  :loading="loading || 'lazy'"
12
- :format="imageAsset.mimeType === 'image/svg+xml' ? 'svg+xml' : 'webp'"
12
+ :format="isSvg ? 'svg+xml' : 'webp'"
13
13
  legacy-format="png"
14
14
  :img-attrs="{ ...imgAttrs, draggable: false }"
15
15
  provider="cachedSanity"
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <PortableText
3
- :value="currentData"
4
- :components="richTextSerializer"
5
- />
2
+ <PortableText
3
+ :value="currentData"
4
+ :components="richTextSerializer"
5
+ />
6
6
  </template>
7
7
 
8
8
  <script setup>
@@ -1,7 +1,7 @@
1
1
  import type { AsyncDataOptions, AsyncDataRequestStatus } from 'nuxt/app';
2
2
  import type { ContentSourceMap, QueryParams } from '@sanity/client';
3
3
  import type { EncodeDataAttributeFunction } from '@sanity/core-loader/encode-data-attribute';
4
- import { type Ref } from 'vue';
4
+ import type { Ref } from 'vue';
5
5
  export interface UseSanityQueryOptions<T> extends AsyncDataOptions<T> {
6
6
  client?: 'default' | 'minimal';
7
7
  perspective?: 'drafts' | 'published' | 'raw';
@@ -1,3 +1,3 @@
1
1
  import type { SEO } from '@devite/nuxt-sanity';
2
- import { type Ref } from 'vue';
2
+ import type { Ref } from 'vue';
3
3
  export declare const useSanitySEO: (url: string, seo: Ref<SEO | undefined>) => void;
@@ -1,4 +1,4 @@
1
1
  export declare const useSanityVisualEditingState: () => {
2
- enabled: boolean;
2
+ enabled: any;
3
3
  isInFrame: () => boolean | undefined;
4
4
  };
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -41,7 +41,10 @@ export default defineEventHandler(async (event) => {
41
41
  const assetId = src.split("/").pop();
42
42
  if (assetId) {
43
43
  const sanityDocumentDeps = useStorage("sanityDocumentDeps");
44
- const documentDeps = await sanityDocumentDeps.getItem(assetId) || [];
44
+ let documentDeps = await sanityDocumentDeps.getItem(assetId);
45
+ if (!documentDeps || !Array.isArray(documentDeps)) {
46
+ documentDeps = [];
47
+ }
45
48
  documentDeps.push(hashedPath);
46
49
  await sanityDocumentDeps.setItem(assetId, documentDeps);
47
50
  if (import.meta.dev) {
@@ -51,7 +51,10 @@ export default defineEventHandler(async (event) => {
51
51
  await Promise.all(referencedIds.map((ref) => new Promise((resolve) => {
52
52
  const id = ref.split('"')[3];
53
53
  sanityDocumentDeps.getItem(id).then((deps) => {
54
- const documentDeps = deps || [];
54
+ let documentDeps = deps;
55
+ if (!documentDeps || !Array.isArray(documentDeps)) {
56
+ documentDeps = [];
57
+ }
55
58
  documentDeps.push(hashedQuery);
56
59
  sanityDocumentDeps.setItem(id, documentDeps).then(resolve);
57
60
  });
@@ -1,5 +1,5 @@
1
1
  import type { ClientPerspective, ContentSourceMap, QueryParams } from '@sanity/client';
2
2
  import type { Reactive } from 'vue';
3
- import { type EncodeDataAttributeFunction } from '@sanity/core-loader/encode-data-attribute';
3
+ import type { EncodeDataAttributeFunction } from '@sanity/core-loader/encode-data-attribute';
4
4
  import type { SanityClient } from '#imports';
5
5
  export declare function fetchSanityData<T>(query: string, params: Reactive<QueryParams> | undefined, client: SanityClient, perspective: ClientPerspective, callback: (data: T | null, sourceMap?: ContentSourceMap, encodeDataAttribute?: EncodeDataAttributeFunction) => void): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "description": "Advanced Sanity integration for Nuxt.js.",
5
5
  "repository": "devite-io/nuxt-sanity",
6
6
  "license": "MIT",
@@ -29,34 +29,34 @@
29
29
  "dependencies": {
30
30
  "@nuxt/image": "^1.10.0",
31
31
  "@portabletext/vue": "^1.0.12",
32
- "@sanity/client": "^7.2.1",
33
- "@sanity/core-loader": "^1.8.8",
32
+ "@sanity/client": "^7.6.0",
33
+ "@sanity/core-loader": "^1.8.10",
34
34
  "@sanity/preview-url-secret": "^2.1.11",
35
- "@sanity/types": "^3.88.2",
36
- "@sanity/visual-editing": "^2.13.21",
35
+ "@sanity/types": "^3.96.0",
36
+ "@sanity/visual-editing": "^2.15.0",
37
37
  "defu": "^6.1.4",
38
38
  "ofetch": "^1.4.1",
39
39
  "ohash": "^1.1.6",
40
40
  "unstorage": "^1.16.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@nuxt/eslint-config": "^1.3.0",
44
- "@nuxt/kit": "^3.17.2",
43
+ "@nuxt/eslint-config": "^1.5.2",
44
+ "@nuxt/kit": "^3.17.6",
45
45
  "@nuxt/module-builder": "^1.0.1",
46
- "@nuxt/schema": "^3.17.2",
47
- "@nuxt/test-utils": "^3.18.0",
46
+ "@nuxt/schema": "^3.17.6",
47
+ "@nuxt/test-utils": "^3.19.2",
48
48
  "@types/node": "latest",
49
49
  "changelogen": "^0.6.1",
50
- "eslint": "^9.26.0",
50
+ "eslint": "^9.30.1",
51
51
  "h3": "^1.15.3",
52
- "nuxt": "^3.17.2",
52
+ "nuxt": "^3.17.6",
53
53
  "typescript": "5.8.3",
54
54
  "vite": "6.3.5",
55
- "vitest": "^3.1.3",
55
+ "vitest": "^3.2.4",
56
56
  "vitest-environment-nuxt": "1.0.1",
57
57
  "vue": "3.5.13",
58
58
  "vue-router": "^4.5.1",
59
- "vue-tsc": "^2.2.10"
59
+ "vue-tsc": "^2.2.12"
60
60
  },
61
61
  "resolutions": {
62
62
  "@devite/nuxt-sanity": "link:."