next-sanity 4.1.8 → 4.2.1-dev.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/index.cjs +16 -6
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -2
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/studio/head.d.ts +2 -0
- package/dist/studio/loading.d.ts +2 -0
- package/package.json +14 -15
- package/src/client.ts +36 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var client = require('@sanity/client');
|
|
6
|
+
var client = require('@sanity/preview-kit/client');
|
|
7
7
|
var groq = require('groq');
|
|
8
8
|
function _interopDefaultCompat(e) {
|
|
9
9
|
return e && typeof e === 'object' && 'default' in e ? e : {
|
|
@@ -11,16 +11,26 @@ function _interopDefaultCompat(e) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var groq__default = /*#__PURE__*/_interopDefaultCompat(groq);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function createClient(config) {
|
|
15
|
+
let {
|
|
16
|
+
// eslint-disable-next-line prefer-const
|
|
17
|
+
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
18
|
+
encodeSourceMap = studioUrl ? "auto" : false
|
|
19
|
+
} = config;
|
|
20
|
+
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
21
|
+
encodeSourceMap = true;
|
|
18
22
|
}
|
|
19
|
-
|
|
23
|
+
return client.createClient({
|
|
24
|
+
...config,
|
|
25
|
+
studioUrl,
|
|
26
|
+
encodeSourceMap
|
|
27
|
+
});
|
|
28
|
+
}
|
|
20
29
|
Object.defineProperty(exports, 'groq', {
|
|
21
30
|
enumerable: true,
|
|
22
31
|
get: function () {
|
|
23
32
|
return groq__default.default;
|
|
24
33
|
}
|
|
25
34
|
});
|
|
35
|
+
exports.createClient = createClient;
|
|
26
36
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.js
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
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\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\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\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":";;;;;;;;;;;;;AA0BO,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;EACJ,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
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import {ClientConfig} from '@sanity/client'
|
|
2
|
-
import {
|
|
2
|
+
import {ClientConfig as ClientConfig_3} from '@sanity/preview-kit/client'
|
|
3
|
+
import {createClient as createClient_2} from '@sanity/preview-kit/client'
|
|
3
4
|
import {default as groq} from 'groq'
|
|
4
5
|
import {SanityClient} from '@sanity/client'
|
|
5
6
|
|
|
6
7
|
export {ClientConfig}
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
/** @public */
|
|
10
|
+
declare interface ClientConfig_2 extends Omit<ClientConfig_3, 'studioUrl' | 'encodeSourceMap'> {
|
|
11
|
+
/**
|
|
12
|
+
* Where the Studio is hosted.
|
|
13
|
+
* If it's embedded in the app, use the base path for example `/studio`.
|
|
14
|
+
* Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.
|
|
15
|
+
* @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
studioUrl?: ClientConfig_3['studioUrl']
|
|
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'
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
encodeSourceMap?: ClientConfig_3['encodeSourceMap']
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare function createClient(config: ClientConfig_2): ReturnType<typeof createClient_2>
|
|
9
31
|
|
|
10
32
|
export {groq}
|
|
11
33
|
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { createClient as createClient$1 } from '@sanity/preview-kit/client';
|
|
2
2
|
export { default as groq } from 'groq';
|
|
3
|
+
function createClient(config) {
|
|
4
|
+
let {
|
|
5
|
+
// eslint-disable-next-line prefer-const
|
|
6
|
+
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
7
|
+
encodeSourceMap = studioUrl ? "auto" : false
|
|
8
|
+
} = config;
|
|
9
|
+
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
10
|
+
encodeSourceMap = true;
|
|
11
|
+
}
|
|
12
|
+
return createClient$1({
|
|
13
|
+
...config,
|
|
14
|
+
studioUrl,
|
|
15
|
+
encodeSourceMap
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { createClient };
|
|
3
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
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\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\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\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":";;AA0BO,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;EACJ,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/dist/studio/head.d.ts
CHANGED
package/dist/studio/loading.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.2.1-dev.0",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -146,10 +146,10 @@
|
|
|
146
146
|
"singleQuote": true
|
|
147
147
|
},
|
|
148
148
|
"dependencies": {
|
|
149
|
-
"@sanity/client": "5",
|
|
150
|
-
"@sanity/preview-kit": "1.4.
|
|
151
|
-
"@sanity/webhook": "2",
|
|
152
|
-
"groq": "3"
|
|
149
|
+
"@sanity/client": "5.4.3-dev.4",
|
|
150
|
+
"@sanity/preview-kit": "1.4.2-dev.1",
|
|
151
|
+
"@sanity/webhook": "^2.0.0",
|
|
152
|
+
"groq": "^3.0.0"
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
155
|
"@rollup/plugin-url": "^8.0.1",
|
|
@@ -167,17 +167,17 @@
|
|
|
167
167
|
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
168
168
|
"autoprefixer": "^10.4.14",
|
|
169
169
|
"eslint": "^8.36.0",
|
|
170
|
-
"eslint-config-next": "13.
|
|
170
|
+
"eslint-config-next": "13.2.4",
|
|
171
171
|
"eslint-config-prettier": "^8.7.0",
|
|
172
172
|
"eslint-config-sanity": "^6.0.0",
|
|
173
173
|
"eslint-gitignore": "^0.1.0",
|
|
174
174
|
"eslint-plugin-prettier": "^4.2.1",
|
|
175
175
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
176
|
-
"groqd": "^0.
|
|
176
|
+
"groqd": "^0.12.0",
|
|
177
177
|
"jest": "^29.5.0",
|
|
178
178
|
"jest-environment-jsdom": "^29.5.0",
|
|
179
179
|
"ls-engines": "^0.9.0",
|
|
180
|
-
"next": "13.
|
|
180
|
+
"next": "13.2.4",
|
|
181
181
|
"postcss": "^8.4.21",
|
|
182
182
|
"prettier": "^2.8.4",
|
|
183
183
|
"prettier-plugin-packagejson": "^2.4.3",
|
|
@@ -193,13 +193,12 @@
|
|
|
193
193
|
"url-loader": "^4.1.1"
|
|
194
194
|
},
|
|
195
195
|
"peerDependencies": {
|
|
196
|
-
"@sanity/icons": "2",
|
|
197
|
-
"@sanity/types": "3",
|
|
198
|
-
"@sanity/ui": "1",
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"sanity": "3",
|
|
196
|
+
"@sanity/icons": "^2",
|
|
197
|
+
"@sanity/types": "^3",
|
|
198
|
+
"@sanity/ui": "^1",
|
|
199
|
+
"next": "^13",
|
|
200
|
+
"react": "^18",
|
|
201
|
+
"sanity": "^3",
|
|
203
202
|
"styled-components": "^5.2"
|
|
204
203
|
},
|
|
205
204
|
"engines": {
|
package/src/client.ts
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClientConfig as _ClientConfig,
|
|
3
|
+
createClient as _createClient,
|
|
4
|
+
} from '@sanity/preview-kit/client'
|
|
5
|
+
|
|
1
6
|
/** @public */
|
|
2
|
-
export
|
|
7
|
+
export interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {
|
|
8
|
+
/**
|
|
9
|
+
* Where the Studio is hosted.
|
|
10
|
+
* If it's embedded in the app, use the base path for example `/studio`.
|
|
11
|
+
* Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.
|
|
12
|
+
* @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
studioUrl?: _ClientConfig['studioUrl']
|
|
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'
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
encodeSourceMap?: _ClientConfig['encodeSourceMap']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export function createClient(config: ClientConfig): ReturnType<typeof _createClient> {
|
|
28
|
+
let {
|
|
29
|
+
// eslint-disable-next-line prefer-const
|
|
30
|
+
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],
|
|
31
|
+
encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],
|
|
32
|
+
} = config
|
|
33
|
+
if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
|
|
34
|
+
encodeSourceMap = true
|
|
35
|
+
}
|
|
36
|
+
return _createClient({...config, studioUrl, encodeSourceMap})
|
|
37
|
+
}
|