next-sanity 4.3.1 → 4.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, '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?: _ClientConfig['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?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\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 _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;;;;;;;;;;;;AA4BO,SAASA,aAAaC,MAAwD,EAAA;EAC/E,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,MAAAA,CAAAA,aAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, '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?: _ClientConfig['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?: _ClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof _createClient>\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 _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\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 _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;;;;;;;;;;;;AA+BO,SAASA,aAAaC,MAAoC,EAAA;EAC3D,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,MAAAA,CAAAA,aAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -24,10 +24,13 @@ export declare interface ClientConfig
24
24
  /**
25
25
  * @public
26
26
  */
27
- export declare function createClient(config: ClientConfig): ReturnType<typeof createClient_2>
27
+ export declare function createClient(config: ClientConfig): SanityClient
28
28
 
29
29
  export {groq}
30
30
 
31
+ /** @public */
32
+ export declare type SanityClient = ReturnType<typeof createClient_2>
33
+
31
34
  export * from '@sanity/preview-kit/client'
32
35
 
33
36
  export {}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, '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?: _ClientConfig['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?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\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 _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;AA4BO,SAASA,aAAaC,MAAwD,EAAA;EAC/E,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,eAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;"}
1
+ {"version":3,"file":"index.js","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, '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?: _ClientConfig['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?: _ClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof _createClient>\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 _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\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 _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;AA+BO,SAASA,aAAaC,MAAoC,EAAA;EAC3D,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,eAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "4.3.1",
3
+ "version": "4.3.2",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -181,7 +181,7 @@
181
181
  "@typescript-eslint/eslint-plugin": "^5.59.2",
182
182
  "autoprefixer": "^10.4.14",
183
183
  "eslint": "^8.39.0",
184
- "eslint-config-next": "13.3.5-canary.5",
184
+ "eslint-config-next": "13.3.5-canary.6",
185
185
  "eslint-config-prettier": "^8.8.0",
186
186
  "eslint-config-sanity": "^6.0.0",
187
187
  "eslint-gitignore": "^0.1.0",
@@ -191,7 +191,7 @@
191
191
  "jest": "^29.5.0",
192
192
  "jest-environment-jsdom": "^29.5.0",
193
193
  "ls-engines": "^0.9.0",
194
- "next": "13.3.5-canary.5",
194
+ "next": "13.3.5-canary.6",
195
195
  "postcss": "^8.4.23",
196
196
  "prettier": "^2.8.8",
197
197
  "prettier-plugin-packagejson": "^2.4.3",
package/src/client.ts CHANGED
@@ -23,10 +23,13 @@ export interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeS
23
23
  encodeSourceMap?: _ClientConfig['encodeSourceMap']
24
24
  }
25
25
 
26
+ /** @public */
27
+ export type SanityClient = ReturnType<typeof _createClient>
28
+
26
29
  /**
27
30
  * @public
28
31
  */
29
- export function createClient(config: ClientConfig): ReturnType<typeof _createClient> {
32
+ export function createClient(config: ClientConfig): SanityClient {
30
33
  let {
31
34
  // eslint-disable-next-line prefer-const, no-process-env
32
35
  studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],