next-sanity 13.0.0-cache-components.4 → 13.0.0-cache-components.5

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.
@@ -0,0 +1,7 @@
1
+ declare const tag = "sanity:debug";
2
+ declare function debug(): Promise<{
3
+ data: number;
4
+ cacheTags: [typeof tag];
5
+ }>;
6
+ export { debug };
7
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","names":[],"sources":["../src/debug.ts"],"sourcesContent":[],"mappings":"cAEM,GAAA,GAAA,cAAA;AAEgB,iBAAA,KAAA,CAAA,CAAS,EAAA,OAAA,CAAA;;qBAA0C"}
package/dist/debug.js ADDED
@@ -0,0 +1,14 @@
1
+ import { cacheTag } from "next/cache";
2
+ const tag = "sanity:debug";
3
+ async function debug() {
4
+ const { resolve, promise } = Promise.withResolvers();
5
+ cacheTag(tag);
6
+ setTimeout(() => resolve(Math.random()), 1e3);
7
+ return {
8
+ data: await promise,
9
+ cacheTags: [tag]
10
+ };
11
+ }
12
+ export { debug };
13
+
14
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +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 \n cacheTag(tag)\n\n setTimeout(() => resolve(Math.random()), 1_000)\n\n return {\n data: await promise,\n cacheTags: [tag],\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"}
@@ -1,8 +1,8 @@
1
1
  "use server";
2
2
  import { t as sanitizePerspective } from "../../sanitizePerspective.js";
3
+ import { revalidateTag } from "next/cache";
3
4
  import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
4
5
  import { cookies, draftMode } from "next/headers";
5
- import { revalidateTag } from "next/cache";
6
6
  async function revalidateSyncTags(tags) {
7
7
  revalidateTag("sanity:fetch-sync-tags", "max");
8
8
  for (const _tag of tags) {
@@ -1,12 +1,12 @@
1
1
  import { t as isCorsOriginError } from "./isCorsOriginError.js";
2
2
  import { n as PUBLISHED_SYNC_TAG_PREFIX, t as DRAFT_SYNC_TAG_PREFIX } from "./constants.js";
3
3
  import { t as resolvePerspectiveFromCookies } from "./resolvePerspectiveFromCookies.js";
4
+ import { cacheLife, cacheTag, updateTag } from "next/cache";
4
5
  import { cookies, draftMode } from "next/headers";
5
6
  import { stegaEncodeSourceMap } from "@sanity/client/stega";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  import { createClient } from "next-sanity";
8
9
  import SanityLiveClientComponent from "next-sanity/experimental/client-components/live";
9
- import { cacheLife, cacheTag, updateTag } from "next/cache";
10
10
  import { preconnect } from "react-dom";
11
11
  async function sanityCachedFetch(config, { query, params = {}, perspective, stega, requestTag, draftToken, customCacheTags = [] }) {
12
12
  "use cache: remote";
@@ -1,6 +1,6 @@
1
1
  "use server";
2
- import { draftMode } from "next/headers";
3
2
  import { revalidatePath } from "next/cache";
3
+ import { draftMode } from "next/headers";
4
4
  async function revalidateRootLayout() {
5
5
  if (!(await draftMode()).isEnabled) {
6
6
  console.warn("Skipped revalidatePath request because draft mode is not enabled");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "13.0.0-cache-components.4",
3
+ "version": "13.0.0-cache-components.5",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "live",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "exports": {
33
33
  ".": "./dist/index.js",
34
+ "./debug": "./dist/debug.js",
34
35
  "./draft-mode": "./dist/draft-mode/index.js",
35
36
  "./experimental/client-components/live": "./dist/experimental/client-components/live.js",
36
37
  "./hooks": "./dist/hooks/index.js",