next-sanity 13.0.0-cache-components.5 → 13.0.0-cache-components.6
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/cache-life.d.ts +32 -0
- package/dist/cache-life.d.ts.map +1 -0
- package/dist/cache-life.js +4 -0
- package/dist/cache-life.js.map +1 -0
- package/dist/debug.js.map +1 -1
- package/package.json +11 -10
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* For usage with `cacheComponents: true`, and `defineLive`:
|
|
3
|
+
* ```ts
|
|
4
|
+
* // next.config.ts
|
|
5
|
+
*
|
|
6
|
+
* import type {NextConfig} from 'next'
|
|
7
|
+
* import {sanity} from 'next-sanity/cache-life'
|
|
8
|
+
*
|
|
9
|
+
* const nextConfig: NextConfig = {
|
|
10
|
+
* cacheComponents: true,
|
|
11
|
+
* cacheLife: {
|
|
12
|
+
* sanity
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* export default nextConfig
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
*
|
|
21
|
+
* async function sanityFetch() {
|
|
22
|
+
* 'use cache'
|
|
23
|
+
* cacheLife('sanity')
|
|
24
|
+
* const {data} = await fetch({query, params})
|
|
25
|
+
* return data
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
declare const sanity: {
|
|
29
|
+
readonly revalidate: 7_776_000;
|
|
30
|
+
};
|
|
31
|
+
export { sanity };
|
|
32
|
+
//# sourceMappingURL=cache-life.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-life.d.ts","names":[],"sources":["../src/cache-life.ts"],"sourcesContent":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-life.js","names":[],"sources":["../src/cache-life.ts"],"sourcesContent":["/**\n * For usage with `cacheComponents: true`, and `defineLive`:\n * ```ts\n * // next.config.ts\n *\n * import type {NextConfig} from 'next'\n * import {sanity} from 'next-sanity/cache-life'\n *\n * const nextConfig: NextConfig = {\n * cacheComponents: true,\n * cacheLife: {\n * sanity\n * }\n * }\n *\n * export default nextConfig\n * ```\n *\n * ```ts\n *\n * async function sanityFetch() {\n * 'use cache'\n * cacheLife('sanity')\n * const {data} = await fetch({query, params})\n * return data\n * }\n */\nexport const sanity = {\n revalidate: 7_776_000, // 90 days,\n} as const satisfies {\n /**\n * This cache may be stale on clients for ... seconds before checking with the server.\n */\n stale?: number\n /**\n * If the server receives a new request after ... seconds, start revalidating new values in the background.\n */\n revalidate?: number\n /**\n * If this entry has no traffic for ... seconds it will expire. The next request will recompute it.\n */\n expire?: number\n}\n"],"mappings":"AA2BA,MAAa,SAAS,EACpB,YAAY,QACb"}
|
package/dist/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","names":[],"sources":["../src/debug.ts"],"sourcesContent":["import {cacheTag} from 'next/cache'\n\nconst tag = 'sanity:debug'\n\nexport async function debug(): Promise<{data: number; cacheTags: [typeof tag]}> {\n const {resolve, promise} = Promise.withResolvers<number>()\n
|
|
1
|
+
{"version":3,"file":"debug.js","names":[],"sources":["../src/debug.ts"],"sourcesContent":["import {cacheTag} from 'next/cache'\n\nconst tag = 'sanity:debug'\n\nexport async function debug(): Promise<{data: number; cacheTags: [typeof tag]}> {\n const {resolve, promise} = Promise.withResolvers<number>()\n\n cacheTag(tag)\n\n setTimeout(() => resolve(Math.random()), 1_000)\n\n return {\n data: await promise,\n cacheTags: [tag],\n }\n}\n"],"mappings":";AAEA,MAAM,MAAM;AAEZ,eAAsB,QAA0D;CAC9E,MAAM,EAAC,SAAS,YAAW,QAAQ,eAAuB;AAE1D,UAAS,IAAI;AAEb,kBAAiB,QAAQ,KAAK,QAAQ,CAAC,EAAE,IAAM;AAE/C,QAAO;EACL,MAAM,MAAM;EACZ,WAAW,CAAC,IAAI;EACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "13.0.0-cache-components.
|
|
3
|
+
"version": "13.0.0-cache-components.6",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"live",
|
|
@@ -15,22 +15,28 @@
|
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/sanity-io/next-sanity/issues"
|
|
17
17
|
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
20
22
|
"url": "git+ssh://git@github.com/sanity-io/next-sanity.git",
|
|
21
23
|
"directory": "packages/next-sanity"
|
|
22
24
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
26
28
|
"type": "module",
|
|
29
|
+
"sideEffects": false,
|
|
27
30
|
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
28
33
|
"imports": {
|
|
29
34
|
"#client-components/*": "./src/shared/client-components/*.tsx",
|
|
30
35
|
"#live/*": "./src/shared/live/*.ts"
|
|
31
36
|
},
|
|
32
37
|
"exports": {
|
|
33
38
|
".": "./dist/index.js",
|
|
39
|
+
"./cache-life": "./dist/cache-life.js",
|
|
34
40
|
"./debug": "./dist/debug.js",
|
|
35
41
|
"./draft-mode": "./dist/draft-mode/index.js",
|
|
36
42
|
"./experimental/client-components/live": "./dist/experimental/client-components/live.js",
|
|
@@ -51,11 +57,6 @@
|
|
|
51
57
|
"./webhook": "./dist/webhook/index.js",
|
|
52
58
|
"./package.json": "./package.json"
|
|
53
59
|
},
|
|
54
|
-
"module": "./dist/index.js",
|
|
55
|
-
"types": "./dist/index.d.ts",
|
|
56
|
-
"files": [
|
|
57
|
-
"dist"
|
|
58
|
-
],
|
|
59
60
|
"dependencies": {
|
|
60
61
|
"@portabletext/react": "^6.0.0",
|
|
61
62
|
"@sanity/client": "^7.13.2",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"@types/react": "^19.2.7",
|
|
76
77
|
"@types/react-dom": "^19.2.3",
|
|
77
78
|
"@vitest/coverage-v8": "^4.0.16",
|
|
78
|
-
"next": "16.1.
|
|
79
|
+
"next": "16.1.1-canary.0",
|
|
79
80
|
"publint": "^0.3.16",
|
|
80
81
|
"react": "^19.2.3",
|
|
81
82
|
"react-dom": "^19.2.3",
|