@devite/nuxt-sanity 2.15.0 → 2.16.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.d.mts CHANGED
@@ -54,6 +54,21 @@ interface VisualEditingOptions {
54
54
  type SanityVisualEditingMode = 'live-visual-editing' | 'visual-editing' | 'custom';
55
55
  type SanityVisualEditingRefreshHandler = (payload: HistoryRefresh, refreshDefault: () => false | Promise<void>) => false | Promise<void>;
56
56
 
57
+ interface LinkExternal {
58
+ _type: 'linkExternal';
59
+ url: string;
60
+ newWindow: boolean;
61
+ linkTitle?: string;
62
+ relationship?: string;
63
+ }
64
+
65
+ interface LinkInternal {
66
+ _type: 'linkInternal';
67
+ slug: string;
68
+ linkTitle?: string;
69
+ relationship?: string;
70
+ }
71
+
57
72
  interface Page {
58
73
  _id: string;
59
74
  _type: 'page';
@@ -70,20 +85,7 @@ interface GlobalSEO {
70
85
  };
71
86
  }
72
87
 
73
- interface LinkExternal {
74
- _type: 'linkExternal';
75
- url: string;
76
- newWindow: boolean;
77
- linkTitle?: string;
78
- relationship?: string;
79
- }
80
-
81
- interface LinkInternal {
82
- _type: 'linkInternal';
83
- slug: string;
84
- linkTitle?: string;
85
- relationship?: string;
86
- }
88
+ type RichText = PortableTextBlock[];
87
89
 
88
90
  interface SEO {
89
91
  _type: 'seo';
@@ -98,8 +100,6 @@ interface SEO {
98
100
  };
99
101
  }
100
102
 
101
- type RichText = PortableTextBlock[];
102
-
103
103
  interface Home {
104
104
  _type: 'home';
105
105
  modules: SanityArray<SanityModule>;
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.15.0",
3
+ "version": "2.16.1",
4
4
  "configKey": "sanity",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import crypto from 'node:crypto';
2
- import { defineNuxtModule, createResolver, addPlugin, addServerHandler, addImports, addServerImports, addComponentsDir, installModule } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addPlugin, addServerHandler, addImports, addServerImports, addComponentsDir } from '@nuxt/kit';
3
2
  import defu from 'defu';
3
+ import { randomBytes } from 'node:crypto';
4
4
 
5
5
  const name = "@devite/nuxt-sanity";
6
- const version = "2.15.0";
6
+ const version = "2.16.1";
7
7
 
8
8
  const CONFIG_KEY = "sanity";
9
9
  const module = defineNuxtModule({
@@ -13,6 +13,9 @@ const module = defineNuxtModule({
13
13
  configKey: CONFIG_KEY
14
14
  },
15
15
  defaults: {},
16
+ moduleDependencies: {
17
+ "@nuxt/image": { version: ">=1.11.0", optional: false }
18
+ },
16
19
  async setup(options, nuxt) {
17
20
  const { resolve } = createResolver(import.meta.url);
18
21
  const $config = nuxt.options.runtimeConfig;
@@ -120,7 +123,7 @@ const module = defineNuxtModule({
120
123
  $config.sanity = defu($config.sanity, {
121
124
  visualEditing: moduleConfig.visualEditing && {
122
125
  ...moduleConfig.visualEditing,
123
- previewModeId: moduleConfig.visualEditing.previewMode ? crypto.randomBytes(16).toString("hex") : "",
126
+ previewModeId: moduleConfig.visualEditing.previewMode ? randomBytes(16).toString("hex") : "",
124
127
  token: moduleConfig.visualEditing.token || ""
125
128
  },
126
129
  webhookSecret: moduleConfig.minimalClient && moduleConfig.minimalClient.webhookSecret || void 0
@@ -172,6 +175,7 @@ const module = defineNuxtModule({
172
175
  { name: "useSanityVisualEditingState", from: resolve("runtime/composables/visual_editing_state") },
173
176
  { name: "useSanitySEO", from: resolve("runtime/composables/sanity_seo") },
174
177
  // helper methods
178
+ { name: "default", as: "useSanityClient", from: resolve("runtime/utils/useSanityClient") },
175
179
  { name: "resolveImageAssetById", from: resolve("runtime/utils/resolveImageAssetById") },
176
180
  { name: "resolveInternalLink", from: resolve("runtime/utils/resolveInternalLink") },
177
181
  // shared
@@ -184,25 +188,19 @@ const module = defineNuxtModule({
184
188
  // shared
185
189
  ...sharedImports
186
190
  ]);
187
- await addComponentsDir({ path: resolve("runtime/components") });
188
- await addComponentsDir({
189
- path: "~/sanity",
190
- global: true,
191
- prefix: "Sanity",
192
- pathPrefix: false
193
- });
194
- await installModule("@nuxt/image", {
195
- providers: {
196
- cachedSanity: {
197
- provider: resolve("runtime/imageProviders/sanity"),
198
- options: {
199
- projectId: moduleConfig.projectId,
200
- dataset: moduleConfig.dataset,
201
- cacheEndpoint: typeof moduleConfig.minimalClient === "object" && moduleConfig.minimalClient.cachingEnabled && moduleConfig.minimalClient.cacheClientBaseUrl + moduleConfig.minimalClient.assetEndpoint || void 0
202
- }
191
+ addComponentsDir({ path: resolve("runtime/components"), pathPrefix: false });
192
+ addComponentsDir({ path: "~/sanity", global: true, prefix: "Sanity", pathPrefix: false });
193
+ if (nuxt.options.image) {
194
+ nuxt.options.image.providers ??= {};
195
+ nuxt.options.image.providers.cachedSanity = {
196
+ provider: resolve("runtime/imageProviders/sanity"),
197
+ options: {
198
+ projectId: moduleConfig.projectId,
199
+ dataset: moduleConfig.dataset,
200
+ cacheEndpoint: typeof moduleConfig.minimalClient === "object" && moduleConfig.minimalClient.cachingEnabled && moduleConfig.minimalClient.cacheClientBaseUrl + moduleConfig.minimalClient.assetEndpoint || void 0
203
201
  }
204
- }
205
- }, nuxt);
202
+ };
203
+ }
206
204
  }
207
205
  });
208
206
 
@@ -1,4 +1,3 @@
1
- import type { Reference } from '@sanity/types';
2
1
  import type { LinkInternal } from '@devite/nuxt-sanity';
3
2
  type __VLS_Props = {
4
3
  data: LinkInternal | {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <NuxtLink
3
- :to="resolvedLink?.slug"
3
+ :to="resolvedLink?.slug + (data.queryString ? `?${data.queryString}` : '')"
4
4
  :title="resolvedLink?.linkTitle"
5
5
  :rel="resolvedLink?.relationship"
6
6
  >
@@ -1,4 +1,3 @@
1
- import type { Reference } from '@sanity/types';
2
1
  import type { LinkInternal } from '@devite/nuxt-sanity';
3
2
  type __VLS_Props = {
4
3
  data: LinkInternal | {
@@ -1,4 +1,4 @@
1
1
  export declare const useSanityVisualEditingState: () => {
2
- enabled: any;
2
+ enabled: boolean;
3
3
  isInFrame: () => boolean | undefined;
4
4
  };
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, 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.15.0",
3
+ "version": "2.16.1",
4
4
  "description": "Advanced Sanity integration for Nuxt.js.",
5
5
  "repository": "devite-io/nuxt-sanity",
6
6
  "license": "MIT",
@@ -30,33 +30,33 @@
30
30
  "@nuxt/image": "^1.11.0",
31
31
  "@portabletext/vue": "^1.0.14",
32
32
  "@sanity/client": "^7.12.0",
33
- "@sanity/core-loader": "^1.8.21",
33
+ "@sanity/core-loader": "^2.0.0",
34
34
  "@sanity/preview-url-secret": "^2.1.15",
35
- "@sanity/types": "^4.11.0",
36
- "@sanity/visual-editing": "^3.2.4",
35
+ "@sanity/types": "^4.12.0",
36
+ "@sanity/visual-editing": "^4.0.0",
37
37
  "defu": "^6.1.4",
38
- "ofetch": "^1.4.1",
38
+ "ofetch": "^1.5.0",
39
39
  "ohash": "^1.1.6",
40
40
  "unstorage": "^1.17.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@nuxt/eslint-config": "^1.9.0",
44
- "@nuxt/kit": "^4.1.3",
43
+ "@nuxt/eslint-config": "^1.10.0",
44
+ "@nuxt/kit": "^4.2.0",
45
45
  "@nuxt/module-builder": "^1.0.2",
46
- "@nuxt/schema": "^4.1.3",
47
- "@nuxt/test-utils": "^3.19.2",
46
+ "@nuxt/schema": "^4.2.0",
47
+ "@nuxt/test-utils": "^3.20.1",
48
48
  "@types/node": "latest",
49
49
  "changelogen": "^0.6.2",
50
50
  "eslint": "^9.38.0",
51
51
  "h3": "^1.15.4",
52
- "nuxt": "^4.1.3",
53
- "typescript": "5.8.3",
54
- "vite": "7.1.11",
55
- "vitest": "^4.0.0",
52
+ "nuxt": "^4.2.0",
53
+ "typescript": "5.9.3",
54
+ "vite": "7.1.12",
55
+ "vitest": "^3.2.4",
56
56
  "vitest-environment-nuxt": "1.0.1",
57
57
  "vue": "3.5.22",
58
58
  "vue-router": "^4.6.3",
59
- "vue-tsc": "^3.1.1"
59
+ "vue-tsc": "^3.1.2"
60
60
  },
61
61
  "resolutions": {
62
62
  "@devite/nuxt-sanity": "link:."