@devite/nuxt-sanity 2.16.1 → 2.17.1

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.16.1",
3
+ "version": "2.17.1",
4
4
  "configKey": "sanity",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -3,10 +3,10 @@ import defu from 'defu';
3
3
  import { randomBytes } from 'node:crypto';
4
4
 
5
5
  const name = "@devite/nuxt-sanity";
6
- const version = "2.16.1";
6
+ const version = "2.17.1";
7
7
 
8
8
  const CONFIG_KEY = "sanity";
9
- const module = defineNuxtModule({
9
+ const module$1 = defineNuxtModule({
10
10
  meta: {
11
11
  name,
12
12
  version,
@@ -204,4 +204,4 @@ const module = defineNuxtModule({
204
204
  }
205
205
  });
206
206
 
207
- export { module as default };
207
+ export { module$1 as default };
@@ -3,9 +3,9 @@ import type { SanityModule } from '@devite/nuxt-sanity';
3
3
  type __VLS_Props = {
4
4
  data?: SanityModule | Array<SanityModule>;
5
5
  };
6
- declare var __VLS_10: any, __VLS_11: any;
6
+ declare var __VLS_11: string, __VLS_12: any;
7
7
  type __VLS_Slots = {} & {
8
- [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
8
+ [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
9
9
  };
10
10
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
11
11
  componentRef: import("vue").Ref<Component | undefined, Component | undefined>;
@@ -3,9 +3,9 @@ import type { SanityModule } from '@devite/nuxt-sanity';
3
3
  type __VLS_Props = {
4
4
  data?: SanityModule | Array<SanityModule>;
5
5
  };
6
- declare var __VLS_10: any, __VLS_11: any;
6
+ declare var __VLS_11: string, __VLS_12: any;
7
7
  type __VLS_Slots = {} & {
8
- [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
8
+ [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
9
9
  };
10
10
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
11
11
  componentRef: import("vue").Ref<Component | undefined, Component | undefined>;
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  prefix?: string;
3
+ allowedSchemaTypes?: string[];
3
4
  };
4
5
  declare var __VLS_6: {};
5
6
  type __VLS_Slots = {} & {
@@ -1,27 +1,28 @@
1
1
  <template>
2
- <main v-if="sanityData?.modules?.length">
3
- <SanityComponent
4
- v-for="(module, index) in sanityData.modules"
5
- :key="module._key"
6
- :index="index"
7
- :data="module"
8
- />
9
- <slot />
10
- </main>
2
+ <main v-if="sanityData?.modules?.length">
3
+ <SanityComponent
4
+ v-for="(module, index) in sanityData.modules"
5
+ :key="module._key"
6
+ :index="index"
7
+ :data="module"
8
+ />
9
+ <slot />
10
+ </main>
11
11
  </template>
12
12
 
13
13
  <script setup>
14
14
  import { computed } from "vue";
15
15
  import { setResponseStatus } from "h3";
16
16
  import { groq, IMAGE_WITHOUT_PREVIEW_PROJECTION, useRequestEvent, useRoute, useRuntimeConfig, useSanityQuery, useSanitySEO } from "#imports";
17
- const { prefix = "" } = defineProps({
18
- prefix: { type: String, required: false }
17
+ const { prefix = "", allowedSchemaTypes = ["page"] } = defineProps({
18
+ prefix: { type: String, required: false },
19
+ allowedSchemaTypes: { type: Array, required: false }
19
20
  });
20
21
  const path = useRoute().path;
21
- const groqFilter = path === "/" ? '_type == "home"' : `_type == "page" && slug.current == $slug`;
22
+ const groqFilter = path === "/" ? '_type == "home"' : `_type in $allowedSchemaTypes && slug.current == $slug`;
22
23
  const { data: sanityData } = await useSanityQuery(
23
24
  groq`*[(${groqFilter}) || _type == "notFound"][0] { _id, _type, slug, title, modules, seo { _type, indexable, title, shortTitle, description, image ${IMAGE_WITHOUT_PREVIEW_PROJECTION} } }`,
24
- { slug: prefix + path.substring(1) }
25
+ { slug: prefix + path.substring(1), allowedSchemaTypes }
25
26
  );
26
27
  if (sanityData.value?._type === "notFound" && import.meta.server) {
27
28
  const event = useRequestEvent();
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  prefix?: string;
3
+ allowedSchemaTypes?: string[];
3
4
  };
4
5
  declare var __VLS_6: {};
5
6
  type __VLS_Slots = {} & {
@@ -6,9 +6,9 @@ type __VLS_Props = {
6
6
  lqip?: boolean;
7
7
  imgAttrs?: Record<string, unknown>;
8
8
  };
9
- declare var __VLS_7: {};
9
+ declare var __VLS_8: {};
10
10
  type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_7) => any;
11
+ default?: (props: typeof __VLS_8) => any;
12
12
  };
13
13
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -6,9 +6,9 @@ type __VLS_Props = {
6
6
  lqip?: boolean;
7
7
  imgAttrs?: Record<string, unknown>;
8
8
  };
9
- declare var __VLS_7: {};
9
+ declare var __VLS_8: {};
10
10
  type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_7) => any;
11
+ default?: (props: typeof __VLS_8) => any;
12
12
  };
13
13
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -2,9 +2,9 @@ import type { LinkExternal } from '@devite/nuxt-sanity';
2
2
  type __VLS_Props = {
3
3
  data: LinkExternal;
4
4
  };
5
- declare var __VLS_7: {};
5
+ declare var __VLS_8: {};
6
6
  type __VLS_Slots = {} & {
7
- default?: (props: typeof __VLS_7) => any;
7
+ default?: (props: typeof __VLS_8) => any;
8
8
  };
9
9
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -2,9 +2,9 @@ import type { LinkExternal } from '@devite/nuxt-sanity';
2
2
  type __VLS_Props = {
3
3
  data: LinkExternal;
4
4
  };
5
- declare var __VLS_7: {};
5
+ declare var __VLS_8: {};
6
6
  type __VLS_Slots = {} & {
7
- default?: (props: typeof __VLS_7) => any;
7
+ default?: (props: typeof __VLS_8) => any;
8
8
  };
9
9
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -4,9 +4,9 @@ type __VLS_Props = {
4
4
  reference: Reference;
5
5
  };
6
6
  };
7
- declare var __VLS_7: {};
7
+ declare var __VLS_8: {};
8
8
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_7) => any;
9
+ default?: (props: typeof __VLS_8) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -4,9 +4,9 @@ type __VLS_Props = {
4
4
  reference: Reference;
5
5
  };
6
6
  };
7
- declare var __VLS_7: {};
7
+ declare var __VLS_8: {};
8
8
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_7) => any;
9
+ default?: (props: typeof __VLS_8) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,2 +1,3 @@
1
- import type { ImageCTX, ImageOptions, ResolvedImage } from '@nuxt/image';
2
- export declare function getImage(src: string, { modifiers, projectId, dataset, cacheEndpoint }: ImageOptions, context: ImageCTX): ResolvedImage;
1
+ import type { ImageOptions } from '@nuxt/image';
2
+ declare const _default: () => import("@nuxt/image").ImageProvider<ImageOptions<never>>;
3
+ export default _default;
@@ -1,12 +1,15 @@
1
- import { getImage as getSanityImage } from "#image/providers/sanity";
2
- export function getImage(src, { modifiers = {}, projectId, dataset, cacheEndpoint }, context) {
3
- modifiers.format = modifiers.format === "svg+xml" ? void 0 : modifiers.format;
4
- if (cacheEndpoint) {
5
- const params = new URLSearchParams();
6
- params.set("src", src);
7
- if (modifiers.format || !src.endsWith("-svg"))
8
- params.set("modifiers", JSON.stringify(modifiers));
9
- return { url: cacheEndpoint + `?${params.toString()}` };
1
+ import sanity from "@nuxt/image/runtime/providers/sanity";
2
+ import { defineProvider } from "@nuxt/image/runtime";
3
+ export default defineProvider({
4
+ getImage(src, { modifiers = {}, projectId, dataset, cacheEndpoint }, context) {
5
+ modifiers.format = modifiers.format === "svg+xml" ? void 0 : modifiers.format;
6
+ if (cacheEndpoint) {
7
+ const params = new URLSearchParams();
8
+ params.set("src", src);
9
+ if (modifiers.format || !src.endsWith("-svg"))
10
+ params.set("modifiers", JSON.stringify(modifiers));
11
+ return { url: cacheEndpoint + `?${params.toString()}` };
12
+ }
13
+ return sanity().getImage(src, { modifiers, projectId, dataset }, context);
10
14
  }
11
- return getSanityImage(src, { modifiers, projectId, dataset }, context);
12
- }
15
+ });
@@ -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: unknown;
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: unknown;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.16.1",
3
+ "version": "2.17.1",
4
4
  "description": "Advanced Sanity integration for Nuxt.js.",
5
5
  "repository": "devite-io/nuxt-sanity",
6
6
  "license": "MIT",
@@ -27,36 +27,36 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@nuxt/image": "^1.11.0",
30
+ "@nuxt/image": "^2.0.0",
31
31
  "@portabletext/vue": "^1.0.14",
32
- "@sanity/client": "^7.12.0",
33
- "@sanity/core-loader": "^2.0.0",
34
- "@sanity/preview-url-secret": "^2.1.15",
35
- "@sanity/types": "^4.12.0",
36
- "@sanity/visual-editing": "^4.0.0",
32
+ "@sanity/client": "^7.13.2",
33
+ "@sanity/core-loader": "^2.0.5",
34
+ "@sanity/preview-url-secret": "^4.0.2",
35
+ "@sanity/types": "^5.1.0",
36
+ "@sanity/visual-editing": "^5.0.4",
37
37
  "defu": "^6.1.4",
38
- "ofetch": "^1.5.0",
39
- "ohash": "^1.1.6",
40
- "unstorage": "^1.17.1"
38
+ "ofetch": "^1.5.1",
39
+ "ohash": "^2.0.11",
40
+ "unstorage": "^1.17.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@nuxt/eslint-config": "^1.10.0",
44
- "@nuxt/kit": "^4.2.0",
43
+ "@nuxt/eslint-config": "^1.12.1",
44
+ "@nuxt/kit": "^4.2.2",
45
45
  "@nuxt/module-builder": "^1.0.2",
46
- "@nuxt/schema": "^4.2.0",
47
- "@nuxt/test-utils": "^3.20.1",
46
+ "@nuxt/schema": "^4.2.2",
47
+ "@nuxt/test-utils": "^3.22.0",
48
48
  "@types/node": "latest",
49
49
  "changelogen": "^0.6.2",
50
- "eslint": "^9.38.0",
50
+ "eslint": "^9.39.2",
51
51
  "h3": "^1.15.4",
52
- "nuxt": "^4.2.0",
53
- "typescript": "5.9.3",
54
- "vite": "7.1.12",
52
+ "nuxt": "^4.2.2",
53
+ "typescript": "^5.9.3",
54
+ "vite": "^7.3.0",
55
55
  "vitest": "^3.2.4",
56
- "vitest-environment-nuxt": "1.0.1",
57
- "vue": "3.5.22",
58
- "vue-router": "^4.6.3",
59
- "vue-tsc": "^3.1.2"
56
+ "vitest-environment-nuxt": "^1.0.1",
57
+ "vue": "^3.5.26",
58
+ "vue-router": "^4.6.4",
59
+ "vue-tsc": "^3.2.1"
60
60
  },
61
61
  "resolutions": {
62
62
  "@devite/nuxt-sanity": "link:."