@devite/nuxt-sanity 2.16.0 → 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.d.mts +9 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/components/SanityPage.d.vue.ts +1 -0
- package/dist/runtime/components/SanityPage.vue +14 -13
- package/dist/runtime/components/SanityPage.vue.d.ts +1 -0
- package/dist/runtime/composables/visual_editing_state.d.ts +1 -1
- package/dist/runtime/imageProviders/sanity.d.ts +3 -2
- package/dist/runtime/imageProviders/sanity.js +14 -11
- package/dist/runtime/plugins/visual-editing.client.d.ts +1 -1
- package/dist/runtime/plugins/visual-editing.server.d.ts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +17 -17
package/dist/module.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { HistoryRefresh, VisualEditingOptions as VisualEditingOptions$1 } from '@sanity/visual-editing';
|
|
3
3
|
import { ClientConfig } from '@sanity/client';
|
|
4
|
-
import { Slug,
|
|
4
|
+
import { Slug, ImageAsset, PortableTextBlock } from '@sanity/types';
|
|
5
5
|
|
|
6
6
|
type ModuleOptions = ClientConfig & {
|
|
7
7
|
projectId?: string;
|
|
@@ -78,6 +78,13 @@ interface Page {
|
|
|
78
78
|
seo: SEO;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
interface GlobalSEO {
|
|
82
|
+
siteName: string;
|
|
83
|
+
image: {
|
|
84
|
+
asset: ImageAsset;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
type RichText = PortableTextBlock[];
|
|
82
89
|
|
|
83
90
|
interface SEO {
|
|
@@ -116,4 +123,4 @@ type SanityArray<T> = Array<T & {
|
|
|
116
123
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
117
124
|
|
|
118
125
|
export { _default as default };
|
|
119
|
-
export type { Home, LinkExternal, LinkInternal, ModuleOptions, NotFound, Page, RichText, SEO, SanityArray, SanityModule, SanityVisualEditingMode, SanityVisualEditingRefreshHandler, VisualEditingOptions };
|
|
126
|
+
export type { GlobalSEO, Home, LinkExternal, LinkInternal, ModuleOptions, NotFound, Page, RichText, SEO, SanityArray, SanityModule, SanityVisualEditingMode, SanityVisualEditingRefreshHandler, VisualEditingOptions };
|
package/dist/module.json
CHANGED
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.
|
|
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,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
|
|
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,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
params.set("
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
}
|
|
15
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: any;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: any;
|
|
2
2
|
export default _default;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default } from './module.mjs'
|
|
2
2
|
|
|
3
|
-
export { type Home, type LinkExternal, type LinkInternal, type ModuleOptions, type NotFound, type Page, type RichText, type SEO, type SanityArray, type SanityModule, type SanityVisualEditingMode, type SanityVisualEditingRefreshHandler, type VisualEditingOptions } from './module.mjs'
|
|
3
|
+
export { type GlobalSEO, type Home, type LinkExternal, type LinkInternal, type ModuleOptions, type NotFound, type Page, type RichText, type SEO, type SanityArray, type SanityModule, type SanityVisualEditingMode, type SanityVisualEditingRefreshHandler, type VisualEditingOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devite/nuxt-sanity",
|
|
3
|
-
"version": "2.
|
|
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": "^
|
|
30
|
+
"@nuxt/image": "^2.0.0",
|
|
31
31
|
"@portabletext/vue": "^1.0.14",
|
|
32
|
-
"@sanity/client": "^7.12.
|
|
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.
|
|
35
|
+
"@sanity/types": "^4.15.0",
|
|
36
36
|
"@sanity/visual-editing": "^4.0.0",
|
|
37
37
|
"defu": "^6.1.4",
|
|
38
|
-
"ofetch": "^1.5.
|
|
38
|
+
"ofetch": "^1.5.1",
|
|
39
39
|
"ohash": "^1.1.6",
|
|
40
|
-
"unstorage": "^1.17.
|
|
40
|
+
"unstorage": "^1.17.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@nuxt/eslint-config": "^1.
|
|
44
|
-
"@nuxt/kit": "^4.2.
|
|
43
|
+
"@nuxt/eslint-config": "^1.10.0",
|
|
44
|
+
"@nuxt/kit": "^4.2.1",
|
|
45
45
|
"@nuxt/module-builder": "^1.0.2",
|
|
46
|
-
"@nuxt/schema": "^4.2.
|
|
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.
|
|
50
|
+
"eslint": "^9.39.1",
|
|
51
51
|
"h3": "^1.15.4",
|
|
52
|
-
"nuxt": "^4.2.
|
|
53
|
-
"typescript": "5.9.3",
|
|
54
|
-
"vite": "7.
|
|
55
|
-
"vitest": "^3.2.
|
|
56
|
-
"vitest-environment-nuxt": "1.0.1",
|
|
57
|
-
"vue": "3.5.
|
|
52
|
+
"nuxt": "^4.2.1",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vite": "^7.2.2",
|
|
55
|
+
"vitest": "^3.2.4",
|
|
56
|
+
"vitest-environment-nuxt": "^1.0.1",
|
|
57
|
+
"vue": "^3.5.24",
|
|
58
58
|
"vue-router": "^4.6.3",
|
|
59
|
-
"vue-tsc": "^3.1.
|
|
59
|
+
"vue-tsc": "^3.1.3"
|
|
60
60
|
},
|
|
61
61
|
"resolutions": {
|
|
62
62
|
"@devite/nuxt-sanity": "link:."
|