next-sanity 7.0.0 → 7.0.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/client.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit/client");exports.createClient=function(r){let{studioUrl:t=process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,encodeSourceMap:o=!!t&&"auto"}=r;return"auto"===o&&"preview"===process.env.NEXT_PUBLIC_VERCEL_ENV&&(o=!0),e.createClient({...r,studioUrl:t,encodeSourceMap:o})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit/client");exports.createClient=function(r){let{studioUrl:t=process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,encodeSourceMap:o=!1}=r;return"auto"===o&&"preview"===process.env.NEXT_PUBLIC_VERCEL_ENV&&(o=!0),e.createClient({...r,studioUrl:t,encodeSourceMap:o})};
2
2
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":"qIAgCO,SAAsBA,GACvB,IAAAC,UAEFA,EAAYC,QAAQC,IAAIC,8BAAAC,gBACxBA,IAAkBJ,GAAY,QAC5BD,EAKJ,MAHwB,SAApBK,GAAqE,YAAvCH,QAAQC,IAAIG,yBAC1BD,GAAA,GAEbE,EAAAA,aAAuB,IAAIP,EAAQC,YAAWI,mBACvD"}
1
+ {"version":3,"file":"client.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If this is false then `@sanity/client` will be used. If set to 'auto' then it's enabled on Vercel Preview Deployments.\n * @defaultValue false\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":"qIAgCO,SAAsBA,GACvB,IAAAC,UAEFA,EAAYC,QAAQC,IAAIC,8BAAAC,gBACxBA,GAAkB,GAChBL,EAKJ,MAHwB,SAApBK,GAAqE,YAAvCH,QAAQC,IAAIG,yBAC1BD,GAAA,GAEbE,EAAAA,aAAuB,IAAIP,EAAQC,YAAWI,mBACvD"}
package/dist/client.js CHANGED
@@ -1,2 +1,2 @@
1
- import{createClient as e}from"@sanity/preview-kit/client";function o(o){let{studioUrl:r=process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,encodeSourceMap:t=!!r&&"auto"}=o;return"auto"===t&&"preview"===process.env.NEXT_PUBLIC_VERCEL_ENV&&(t=!0),e({...o,studioUrl:r,encodeSourceMap:t})}export{o as createClient};
1
+ import{createClient as e}from"@sanity/preview-kit/client";function r(r){let{studioUrl:o=process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,encodeSourceMap:t=!1}=r;return"auto"===t&&"preview"===process.env.NEXT_PUBLIC_VERCEL_ENV&&(t=!0),e({...r,studioUrl:o,encodeSourceMap:t})}export{r as createClient};
2
2
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":"0DAgCO,SAASA,EAAaC,GACvB,IAAAC,UAEFA,EAAYC,QAAQC,IAAIC,8BAAAC,gBACxBA,IAAkBJ,GAAY,QAC5BD,EAKJ,MAHwB,SAApBK,GAAqE,YAAvCH,QAAQC,IAAIG,yBAC1BD,GAAA,GAEbE,EAAuB,IAAIP,EAAQC,YAAWI,mBACvD"}
1
+ {"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If this is false then `@sanity/client` will be used. If set to 'auto' then it's enabled on Vercel Preview Deployments.\n * @defaultValue false\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":"0DAgCO,SAASA,EAAaC,GACvB,IAAAC,UAEFA,EAAYC,QAAQC,IAAIC,8BAAAC,gBACxBA,GAAkB,GAChBL,EAKJ,MAHwB,SAApBK,GAAqE,YAAvCH,QAAQC,IAAIG,yBAC1BD,GAAA,GAEbE,EAAuB,IAAIP,EAAQC,YAAWI,mBACvD"}
package/dist/index.d.ts CHANGED
@@ -14,8 +14,8 @@ export declare interface ClientConfig
14
14
  */
15
15
  studioUrl?: PreviewKitClientConfig['studioUrl']
16
16
  /**
17
- * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.
18
- * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'
17
+ * If this is false then `@sanity/client` will be used. If set to 'auto' then it's enabled on Vercel Preview Deployments.
18
+ * @defaultValue false
19
19
  * @alpha
20
20
  */
21
21
  encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -173,8 +173,8 @@
173
173
  "singleQuote": true
174
174
  },
175
175
  "dependencies": {
176
- "@sanity/client": "^6.9.1",
177
- "@sanity/preview-kit": "5.0.0",
176
+ "@sanity/client": "^6.9.2",
177
+ "@sanity/preview-kit": "5.0.3",
178
178
  "@sanity/webhook": "4.0.0",
179
179
  "groq": "^3.19"
180
180
  },
@@ -184,44 +184,44 @@
184
184
  "@rollup/plugin-terser": "^0.4.4",
185
185
  "@sanity/eslint-config-studio": "^3.0.1",
186
186
  "@sanity/image-url": "^1.0.2",
187
- "@sanity/overlays": "2.0.4",
188
- "@sanity/pkg-utils": "^3.3.0",
187
+ "@sanity/overlays": "2.1.3",
188
+ "@sanity/pkg-utils": "^3.3.3",
189
189
  "@sanity/ui": "^1.9.3",
190
- "@sanity/vision": "3.20.2",
191
- "@types/react": "^18.2.39",
190
+ "@sanity/vision": "3.21.0",
191
+ "@types/react": "^18.2.42",
192
192
  "@types/react-dom": "^18.2.17",
193
- "@typescript-eslint/eslint-plugin": "^6.13.1",
194
- "@vitest/coverage-v8": "^0.34.6",
193
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
194
+ "@vitest/coverage-v8": "^1.0.2",
195
195
  "autoprefixer": "^10.4.16",
196
- "eslint": "^8.54.0",
197
- "eslint-config-prettier": "^9.0.0",
196
+ "eslint": "^8.55.0",
197
+ "eslint-config-prettier": "^9.1.0",
198
198
  "eslint-config-sanity": "^7.0.1",
199
199
  "eslint-gitignore": "^0.1.0",
200
200
  "eslint-plugin-prettier": "^5.0.1",
201
201
  "eslint-plugin-simple-import-sort": "^10.0.0",
202
202
  "groqd": "^0.15.10",
203
203
  "ls-engines": "^0.9.1",
204
- "next": "14.0.4-canary.27",
205
- "postcss": "^8.4.31",
204
+ "next": "14.0.4-canary.47",
205
+ "postcss": "^8.4.32",
206
206
  "prettier": "^3.1.0",
207
- "prettier-plugin-packagejson": "^2.4.6",
208
- "prettier-plugin-tailwindcss": "^0.5.7",
207
+ "prettier-plugin-packagejson": "^2.4.7",
208
+ "prettier-plugin-tailwindcss": "^0.5.9",
209
209
  "react": "^18.2.0",
210
210
  "react-dom": "^18.2.0",
211
211
  "react-is": "^18.2.0",
212
- "rollup": "^4.6.0",
213
- "sanity": "3.20.2",
212
+ "rollup": "^4.6.1",
213
+ "sanity": "3.21.0",
214
214
  "server-only": "^0.0.1",
215
215
  "styled-components": "^6.1.1",
216
216
  "suspend-react": "^0.1.3",
217
- "tailwindcss": "^3.3.5",
218
- "typescript": "^5.3.2",
217
+ "tailwindcss": "^3.3.6",
218
+ "typescript": "^5.3.3",
219
219
  "url-loader": "^4.1.1",
220
- "vitest": "^0.34.6",
221
- "vitest-github-actions-reporter": "^0.11.0"
220
+ "vitest": "^1.0.2",
221
+ "vitest-github-actions-reporter": "^0.11.1"
222
222
  },
223
223
  "peerDependencies": {
224
- "@sanity/client": "^6.9.1",
224
+ "@sanity/client": "^6.9.2",
225
225
  "@sanity/icons": "^2.0",
226
226
  "@sanity/types": "^3.19",
227
227
  "@sanity/ui": "^1.8",
package/src/client.ts CHANGED
@@ -17,8 +17,8 @@ export interface ClientConfig
17
17
  */
18
18
  studioUrl?: PreviewKitClientConfig['studioUrl']
19
19
  /**
20
- * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.
21
- * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'
20
+ * If this is false then `@sanity/client` will be used. If set to 'auto' then it's enabled on Vercel Preview Deployments.
21
+ * @defaultValue false
22
22
  * @alpha
23
23
  */
24
24
  encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']
@@ -34,7 +34,7 @@ export function createClient(config: ClientConfig): SanityClient {
34
34
  let {
35
35
  // eslint-disable-next-line prefer-const, no-process-env
36
36
  studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],
37
- encodeSourceMap = studioUrl ? 'auto' : false,
37
+ encodeSourceMap = false,
38
38
  } = config
39
39
  // eslint-disable-next-line no-process-env
40
40
  if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {