@devite/nuxt-sanity 2.16.1 → 2.17.0

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.0",
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.0";
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 };
@@ -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 = {} & {
@@ -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,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: 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;
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.0",
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",
32
+ "@sanity/client": "^7.12.1",
33
33
  "@sanity/core-loader": "^2.0.0",
34
34
  "@sanity/preview-url-secret": "^2.1.15",
35
- "@sanity/types": "^4.12.0",
35
+ "@sanity/types": "^4.15.0",
36
36
  "@sanity/visual-editing": "^4.0.0",
37
37
  "defu": "^6.1.4",
38
- "ofetch": "^1.5.0",
38
+ "ofetch": "^1.5.1",
39
39
  "ohash": "^1.1.6",
40
- "unstorage": "^1.17.1"
40
+ "unstorage": "^1.17.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@nuxt/eslint-config": "^1.10.0",
44
- "@nuxt/kit": "^4.2.0",
44
+ "@nuxt/kit": "^4.2.1",
45
45
  "@nuxt/module-builder": "^1.0.2",
46
- "@nuxt/schema": "^4.2.0",
46
+ "@nuxt/schema": "^4.2.1",
47
47
  "@nuxt/test-utils": "^3.20.1",
48
48
  "@types/node": "latest",
49
49
  "changelogen": "^0.6.2",
50
- "eslint": "^9.38.0",
50
+ "eslint": "^9.39.1",
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.1",
53
+ "typescript": "^5.9.3",
54
+ "vite": "^7.2.2",
55
55
  "vitest": "^3.2.4",
56
- "vitest-environment-nuxt": "1.0.1",
57
- "vue": "3.5.22",
56
+ "vitest-environment-nuxt": "^1.0.1",
57
+ "vue": "^3.5.24",
58
58
  "vue-router": "^4.6.3",
59
- "vue-tsc": "^3.1.2"
59
+ "vue-tsc": "^3.1.3"
60
60
  },
61
61
  "resolutions": {
62
62
  "@devite/nuxt-sanity": "link:."