next-sanity 12.3.1 → 12.3.3

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,5 +1,5 @@
1
1
  import { l as setComlink, u as setComlinkClientConfig } from "./context.js";
2
- import { useRouter } from "next/navigation.js";
2
+ import { useRouter } from "next/navigation";
3
3
  import { useEffect, useEffectEvent } from "react";
4
4
  import { createNode, createNodeMachine } from "@sanity/comlink";
5
5
  import { createCompatibilityActors } from "@sanity/presentation-comlink";
@@ -1,4 +1,4 @@
1
- import { useRouter } from "next/navigation.js";
1
+ import { useRouter } from "next/navigation";
2
2
  import { useEffect } from "react";
3
3
  const focusThrottleInterval = 5e3;
4
4
  function RefreshOnFocus() {
@@ -1,4 +1,4 @@
1
- import { useRouter } from "next/navigation.js";
1
+ import { useRouter } from "next/navigation";
2
2
  import { useEffect, useReducer } from "react";
3
3
  /**
4
4
  * Handles refreshing the page when the page is mounted,
@@ -1,4 +1,4 @@
1
- import { useRouter } from "next/navigation.js";
1
+ import { useRouter } from "next/navigation";
2
2
  import { useEffect } from "react";
3
3
  function RefreshOnReconnect() {
4
4
  const router = useRouter();
@@ -1,4 +1,4 @@
1
- import { usePathname, useRouter, useSearchParams } from "next/navigation.js";
1
+ import { usePathname, useRouter, useSearchParams } from "next/navigation";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { VisualEditing as VisualEditing$1 } from "@sanity/visual-editing/react";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -32,37 +32,6 @@ type DefinedSanityFetchType = <const QueryString extends string>(options: {
32
32
  /**
33
33
  * @public
34
34
  */
35
- type DefinedSanityLiveStreamType = <const QueryString extends string>(props: {
36
- query: QueryString;
37
- params?: QueryParams | Promise<QueryParams>;
38
- /**
39
- * Add custom `next.tags` to the underlying fetch request.
40
- * @see https://nextjs.org/docs/app/api-reference/functions/fetch#optionsnexttags
41
- * This can be used in conjunction with custom fallback revalidation strategies, as well as with custom Server Actions that mutate data and want to render with fresh data right away (faster than the Live Event latency).
42
- * @defaultValue `['sanity']`
43
- */
44
- tags?: string[];
45
- perspective?: Exclude<ClientPerspective, "raw">;
46
- stega?: boolean;
47
- /**
48
- * @deprecated use `requestTag` instead
49
- */
50
- tag?: never;
51
- /**
52
- * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.
53
- * @see https://www.sanity.io/docs/reference-api-request-tags
54
- * @defaultValue 'next-loader.live-stream.fetch'
55
- */
56
- requestTag?: string;
57
- children: (result: {
58
- data: ClientReturn<QueryString>;
59
- sourceMap: ContentSourceMap | null;
60
- tags: string[];
61
- }) => Promise<Awaited<React.ReactNode>>;
62
- }) => React.ReactNode;
63
- /**
64
- * @public
65
- */
66
35
  interface DefinedSanityLiveProps {
67
36
  /**
68
37
  * Automatic refresh of RSC when the component <SanityLive /> is mounted.
@@ -172,10 +141,6 @@ declare function defineLive(config: DefineSanityLiveOptions): {
172
141
  * @public
173
142
  */
174
143
  SanityLive: React.ComponentType<DefinedSanityLiveProps>;
175
- /**
176
- * @alpha experimental, it may change or even be removed at any time
177
- */
178
- SanityLiveStream: DefinedSanityLiveStreamType;
179
144
  };
180
- export { defineLive as a, DefinedSanityLiveStreamType as i, DefinedSanityFetchType as n, DefinedSanityLiveProps as r, DefineSanityLiveOptions as t };
145
+ export { defineLive as i, DefinedSanityFetchType as n, DefinedSanityLiveProps as r, DefineSanityLiveOptions as t };
181
146
  //# sourceMappingURL=defineLive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineLive.d.ts","names":[],"sources":["../src/live/defineLive.tsx"],"mappings":";;AAoBA;;KAAY,sBAAA,sCAA4D,OAAA;EACtE,KAAA,EAAO,WAAA;EACP,MAAA,GAAS,WAAA,GAAc,OAAA,CAAQ,WAAA;;;;;;;EAO/B,IAAA;EACA,WAAA,GAAc,OAAA,CAAQ,iBAAA;EACtB,KAAA;EAWI;;;EAPJ,GAAA;;;;;;EAMA,UAAA;AAAA,MACI,OAAA;E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EAAO,WAAA;EACP,MAAA,GAAS,WAAA,GAAc,OAAA,CAAQ,WAAA;;;;;;;EAO/B,IAAA;EACA,WAAA,GAAc,OAAA,CAAQ,iBAAA;EACtB,KAAA;EAWI;;;EAPJ,GAAA;;;;;;EAMA,UAAA;AAAA,MACI,OAAA;EACJ,IAAA,EAAM,YAAA,CAAa,WAAA;EACnB,SAAA,EAAW,gBAAA;EACX,IAAA;AAAA;;;;UAMe,sBAAA;;;;;;EAMf,cAAA;EANF;;;;;EAYE,cAAA;;;;;;EAMA,kBAAA;;;;;;;;EAQA,gBAAA;;;;;EAMA,OAAA;;;AAsCF;EAjCE,GAAA;;;;;;EAOA,UAAA;;;;;EAMA,OAAA,IAAW,KAAA;EAwDb;;;;;;EAhDE,QAAA,IAAY,KAAA,EAAO,eAAA,EAAiB,gBAAA;;;;;EAMpC,kBAAA,IAAsB,IAAA,EAAM,OAAA,OAAc,OAAA;AAAA;;;;UAM3B,uBAAA;;;;EAIf,MAAA,EAAQ,YAAA;;;;;EAKR,WAAA;;;;;EAKA,YAAA;;;;;EAKA,YAAA;;;;;IAKE,UAAA;EAAA;;;;;EAMF,KAAA;AAAA;;;;iBAMc,UAAA,CAAW,MAAA,EAAQ,uBAAA;;;;;EAKjC,WAAA,EAAa,sBAAA;;;;;EAKb,UAAA,EAAY,KAAA,CAAM,aAAA,CAAc,sBAAA;AAAA"}
@@ -1,7 +1,7 @@
1
1
  import { validatePreviewUrl } from "@sanity/preview-url-secret";
2
2
  import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
3
- import { cookies, draftMode } from "next/headers.js";
4
- import { redirect } from "next/navigation.js";
3
+ import { cookies, draftMode } from "next/headers";
4
+ import { redirect } from "next/navigation";
5
5
  /**
6
6
  * Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.
7
7
  * Can also be used with `sanity-plugin-iframe-pane`.
@@ -1,4 +1,4 @@
1
- import { ImageLoader, ImageProps as ImageProps$1 } from "next/image.js";
1
+ import { ImageLoader, ImageProps as ImageProps$1 } from "next/image";
2
2
  /**
3
3
  * @alpha
4
4
  */
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import NextImage from "next/image.js";
2
+ import NextImage from "next/image";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  /**
5
5
  * @alpha
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { d as setEnvironment, f as setPerspective } from "../../../context.js";
3
3
  import { t as isCorsOriginError } from "../../../isCorsOriginError.js";
4
- import { useRouter } from "next/navigation.js";
4
+ import { useRouter } from "next/navigation";
5
5
  import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
6
6
  import { isMaybePresentation, isMaybePreviewWindow } from "@sanity/presentation-comlink";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { createClient } from "@sanity/client";
9
9
  import { revalidateSyncTags } from "next-sanity/live/server-actions";
10
- import dynamic from "next/dynamic.js";
10
+ import dynamic from "next/dynamic";
11
11
  const PresentationComlink = dynamic(() => import("../../../PresentationComlink.js"), { ssr: false });
12
12
  const RefreshOnMount = dynamic(() => import("../../../RefreshOnMount.js"), { ssr: false });
13
13
  const RefreshOnFocus = dynamic(() => import("../../../RefreshOnFocus.js"), { ssr: false });
@@ -1,8 +1,8 @@
1
1
  "use server";
2
2
  import { t as sanitizePerspective } from "../../utils.js";
3
3
  import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
4
- import { cookies, draftMode } from "next/headers.js";
5
- import { revalidateTag } from "next/cache.js";
4
+ 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) {
package/dist/live.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as isCorsOriginError } from "./isCorsOriginError.js";
2
- import { a as defineLive, i as DefinedSanityLiveStreamType, n as DefinedSanityFetchType, r as DefinedSanityLiveProps, t as DefineSanityLiveOptions } from "./defineLive.js";
3
- export { type DefineSanityLiveOptions, type DefinedSanityFetchType, type DefinedSanityLiveProps, type DefinedSanityLiveStreamType, defineLive, isCorsOriginError };
2
+ import { i as defineLive, n as DefinedSanityFetchType, r as DefinedSanityLiveProps, t as DefineSanityLiveOptions } from "./defineLive.js";
3
+ export { type DefineSanityLiveOptions, type DefinedSanityFetchType, type DefinedSanityLiveProps, defineLive, isCorsOriginError };
package/dist/live.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import { t as isCorsOriginError } from "./isCorsOriginError.js";
2
2
  import { t as sanitizePerspective } from "./utils.js";
3
3
  import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
4
- import { cookies, draftMode } from "next/headers.js";
4
+ import { cookies, draftMode } from "next/headers";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import "@sanity/client";
7
7
  import SanityLiveClientComponent from "next-sanity/live/client-components/live";
8
- import SanityLiveStreamClientComponent from "next-sanity/live/client-components/live-stream";
9
- import { PHASE_PRODUCTION_BUILD } from "next/constants.js";
8
+ import { PHASE_PRODUCTION_BUILD } from "next/constants";
10
9
  import { preconnect, prefetchDNS } from "react-dom";
11
10
  /**
12
11
  * @internal
@@ -28,48 +27,47 @@ function defineLive(config) {
28
27
  });
29
28
  const { token: originalToken } = client.config();
30
29
  const studioUrlDefined = typeof client.config().stega.studioUrl !== "undefined";
31
- const sanityFetch = async function sanityFetch({ query, params = {}, stega: _stega, tags = [], perspective: _perspective, tag, requestTag = tag ?? "next-loader.fetch" }) {
32
- const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled);
33
- const perspective = _perspective ?? await resolveCookiePerspective();
34
- const useCdn = perspective === "published";
35
- const revalidate = fetchOptions?.revalidate !== void 0 ? fetchOptions.revalidate : process.env.NODE_ENV === "production" ? false : void 0;
36
- const isBuildPhase = process.env["NEXT_PHASE"] === PHASE_PRODUCTION_BUILD;
37
- const cacheMode = useCdn && !isBuildPhase ? "noStale" : void 0;
38
- const { syncTags } = await client.fetch(query, await params, {
39
- filterResponse: false,
40
- perspective,
41
- stega: false,
42
- returnQuery: false,
43
- next: {
44
- revalidate,
45
- tags: [...tags, "sanity:fetch-sync-tags"]
46
- },
47
- useCdn,
48
- cacheMode,
49
- tag: [requestTag, "fetch-sync-tags"].filter(Boolean).join(".")
50
- });
51
- const cacheTags = [...tags, ...syncTags?.map((tag) => `sanity:${tag}`) || []];
52
- const { result, resultSourceMap } = await client.fetch(query, await params, {
53
- filterResponse: false,
54
- perspective,
55
- stega,
56
- token: perspective !== "published" && serverToken ? serverToken : originalToken,
57
- next: {
58
- revalidate,
59
- tags: cacheTags
60
- },
61
- useCdn,
62
- cacheMode,
63
- tag: requestTag
64
- });
65
- return {
66
- data: result,
67
- sourceMap: resultSourceMap || null,
68
- tags: cacheTags
69
- };
70
- };
71
30
  return {
72
- sanityFetch,
31
+ sanityFetch: async function sanityFetch({ query, params = {}, stega: _stega, tags = [], perspective: _perspective, tag, requestTag = tag ?? "next-loader.fetch" }) {
32
+ const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled);
33
+ const perspective = _perspective ?? await resolveCookiePerspective();
34
+ const useCdn = perspective === "published";
35
+ const revalidate = fetchOptions?.revalidate !== void 0 ? fetchOptions.revalidate : process.env.NODE_ENV === "production" ? false : void 0;
36
+ const isBuildPhase = process.env["NEXT_PHASE"] === PHASE_PRODUCTION_BUILD;
37
+ const cacheMode = useCdn && !isBuildPhase ? "noStale" : void 0;
38
+ const { syncTags } = await client.fetch(query, await params, {
39
+ filterResponse: false,
40
+ perspective,
41
+ stega: false,
42
+ returnQuery: false,
43
+ next: {
44
+ revalidate,
45
+ tags: [...tags, "sanity:fetch-sync-tags"]
46
+ },
47
+ useCdn,
48
+ cacheMode,
49
+ tag: [requestTag, "fetch-sync-tags"].filter(Boolean).join(".")
50
+ });
51
+ const cacheTags = [...tags, ...syncTags?.map((tag) => `sanity:${tag}`) || []];
52
+ const { result, resultSourceMap } = await client.fetch(query, await params, {
53
+ filterResponse: false,
54
+ perspective,
55
+ stega,
56
+ token: perspective !== "published" && serverToken ? serverToken : originalToken,
57
+ next: {
58
+ revalidate,
59
+ tags: cacheTags
60
+ },
61
+ useCdn,
62
+ cacheMode,
63
+ tag: requestTag
64
+ });
65
+ return {
66
+ data: result,
67
+ sourceMap: resultSourceMap || null,
68
+ tags: cacheTags
69
+ };
70
+ },
73
71
  SanityLive: async function SanityLive(props) {
74
72
  const { refreshOnMount, refreshOnFocus, refreshOnReconnect, tag, requestTag = tag, onError, onGoAway, intervalOnGoAway, revalidateSyncTags, waitFor } = props;
75
73
  const { projectId, dataset, apiHost, apiVersion, useProjectHostname, requestTagPrefix } = client.config();
@@ -97,42 +95,6 @@ function defineLive(config) {
97
95
  revalidateSyncTags,
98
96
  waitFor
99
97
  });
100
- },
101
- SanityLiveStream: async function SanityLiveStream(props) {
102
- const { query, params, perspective: _perspective, stega: _stega, tags, children, tag, requestTag = tag ?? "next-loader.live-stream.fetch" } = props;
103
- const { data, sourceMap, tags: cacheTags } = await sanityFetch({
104
- query,
105
- params,
106
- tags,
107
- perspective: _perspective,
108
- stega: _stega,
109
- requestTag
110
- });
111
- const { isEnabled: isDraftModeEnabled } = await draftMode();
112
- if (isDraftModeEnabled) {
113
- const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled);
114
- const perspective = _perspective ?? await resolveCookiePerspective();
115
- const { projectId, dataset } = client.config();
116
- return /* @__PURE__ */ jsx(SanityLiveStreamClientComponent, {
117
- projectId,
118
- dataset,
119
- query,
120
- params: await params,
121
- perspective,
122
- stega,
123
- initial: children({
124
- data,
125
- sourceMap,
126
- tags: cacheTags
127
- }),
128
- children
129
- });
130
- }
131
- return children({
132
- data,
133
- sourceMap,
134
- tags: cacheTags
135
- });
136
98
  }
137
99
  };
138
100
  }
package/dist/live.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"live.js","names":[],"sources":["../src/live/resolveCookiePerspective.ts","../src/live/defineLive.tsx"],"sourcesContent":["import type {ClientPerspective} from '@sanity/client'\nimport {perspectiveCookieName} from '@sanity/preview-url-secret/constants'\nimport {cookies, draftMode} from 'next/headers'\n\nimport {sanitizePerspective} from './utils'\n\n/**\n * @internal\n */\nexport async function resolveCookiePerspective(): Promise<Exclude<ClientPerspective, 'raw'>> {\n return (await draftMode()).isEnabled\n ? (await cookies()).has(perspectiveCookieName)\n ? sanitizePerspective((await cookies()).get(perspectiveCookieName)?.value, 'drafts')\n : 'drafts'\n : 'published'\n}\n","import {\n type ClientPerspective,\n type ClientReturn,\n type ContentSourceMap,\n type LiveEventGoAway,\n type QueryParams,\n type SanityClient,\n type SyncTag,\n} from '@sanity/client'\nimport SanityLiveClientComponent from 'next-sanity/live/client-components/live'\nimport SanityLiveStreamClientComponent from 'next-sanity/live/client-components/live-stream'\nimport {PHASE_PRODUCTION_BUILD} from 'next/constants'\nimport {draftMode} from 'next/headers'\nimport {prefetchDNS, preconnect} from 'react-dom'\n\nimport {resolveCookiePerspective} from './resolveCookiePerspective'\n\n/**\n * @public\n */\nexport type DefinedSanityFetchType = <const QueryString extends string>(options: {\n query: QueryString\n params?: QueryParams | Promise<QueryParams>\n /**\n * Add custom `next.tags` to the underlying fetch request.\n * @see https://nextjs.org/docs/app/api-reference/functions/fetch#optionsnexttags\n * This can be used in conjunction with custom fallback revalidation strategies, as well as with custom Server Actions that mutate data and want to render with fresh data right away (faster than the Live Event latency).\n * @defaultValue `['sanity']`\n */\n tags?: string[]\n perspective?: Exclude<ClientPerspective, 'raw'>\n stega?: boolean\n /**\n * @deprecated use `requestTag` instead\n */\n tag?: never\n /**\n * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.\n * @see https://www.sanity.io/docs/reference-api-request-tags\n * @defaultValue 'next-loader.fetch'\n */\n requestTag?: string\n}) => Promise<{\n data: ClientReturn<QueryString>\n sourceMap: ContentSourceMap | null\n tags: string[]\n}>\n\n/**\n * @public\n */\nexport type DefinedSanityLiveStreamType = <const QueryString extends string>(props: {\n query: QueryString\n params?: QueryParams | Promise<QueryParams>\n /**\n * Add custom `next.tags` to the underlying fetch request.\n * @see https://nextjs.org/docs/app/api-reference/functions/fetch#optionsnexttags\n * This can be used in conjunction with custom fallback revalidation strategies, as well as with custom Server Actions that mutate data and want to render with fresh data right away (faster than the Live Event latency).\n * @defaultValue `['sanity']`\n */\n tags?: string[]\n perspective?: Exclude<ClientPerspective, 'raw'>\n stega?: boolean\n /**\n * @deprecated use `requestTag` instead\n */\n tag?: never\n /**\n * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.\n * @see https://www.sanity.io/docs/reference-api-request-tags\n * @defaultValue 'next-loader.live-stream.fetch'\n */\n requestTag?: string\n children: (result: {\n data: ClientReturn<QueryString>\n sourceMap: ContentSourceMap | null\n tags: string[]\n }) => Promise<Awaited<React.ReactNode>>\n}) => React.ReactNode\n\n/**\n * @public\n */\nexport interface DefinedSanityLiveProps {\n /**\n * Automatic refresh of RSC when the component <SanityLive /> is mounted.\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `true`\n */\n refreshOnMount?: boolean\n /**\n * Automatically refresh when window gets focused\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `false` if draftMode().isEnabled, otherwise `true` if not inside an iframe\n */\n refreshOnFocus?: boolean\n /**\n * Automatically refresh when the browser regains a network connection (via navigator.onLine)\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `true`\n */\n refreshOnReconnect?: boolean\n /**\n * Automatically refresh on an interval when the Live Event API emits a `goaway` event, which indicates that the connection is rejected or closed.\n * This typically happens if the connection limit is reached, or if the connection is idle for too long.\n * To disable this long polling fallback behavior set `intervalOnGoAway` to `false` or `0`.\n * You can also use `onGoAway` to handle the `goaway` event in your own way, and read the reason why the event was emitted.\n * @defaultValue `30_000` 30 seconds interval\n */\n intervalOnGoAway?: number | false\n\n /**\n * Delays events until after a Sanity Function has processed them and called the callback endpoint.\n * When omitted, events are delivered immediately.\n */\n waitFor?: 'function'\n\n /**\n * @deprecated use `requestTag` instead\n */\n tag?: never\n\n /**\n * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.\n * @see https://www.sanity.io/docs/reference-api-request-tags\n * @defaultValue 'next-loader.live'\n */\n requestTag?: string\n\n /**\n * Handle errors from the Live Events subscription.\n * By default it's reported using `console.error`, you can override this prop to handle it in your own way.\n */\n onError?: (error: unknown) => void\n\n /**\n * Handle the `goaway` event if the connection is rejected/closed.\n * `event.reason` will be a string of why the event was emitted, for example `'connection limit reached'`.\n * When this happens the `<SanityLive />` will fallback to long polling with a default interval of 30 seconds, providing your own `onGoAway` handler does not change this behavior.\n * If you want to disable long polling set `intervalOnGoAway` to `false` or `0`.\n */\n onGoAway?: (event: LiveEventGoAway, intervalOnGoAway: number | false) => void\n\n /**\n * Override how cache tags are invalidated, you need to pass a server action here.\n * You can also pass a `use client` function here, and have `router.refresh()` be called if the promise resolves to `'refresh'`.\n */\n revalidateSyncTags?: (tags: SyncTag[]) => Promise<void | 'refresh'>\n}\n\n/**\n * @public\n */\nexport interface DefineSanityLiveOptions {\n /**\n * Required for `sanityFetch` and `SanityLive` to work\n */\n client: SanityClient\n /**\n * Optional. If provided then the token needs to have permissions to query documents with `drafts.` prefixes in order for `perspective: 'drafts'` to work.\n * This token is not shared with the browser.\n */\n serverToken?: string | false\n /**\n * Optional. This token is shared with the browser, and should only have access to query published documents.\n * It is used to setup a `Live Draft Content` EventSource connection, and enables live previewing drafts stand-alone, outside of Presentation Tool.\n */\n browserToken?: string | false\n /**\n * Fetch options used by `sanityFetch`\n * @deprecated this option is removed in the next major version, use `export const revalidate` on the `page.tsx` or `layout.tsx` instead\n */\n fetchOptions?: {\n /**\n * Optional, enables time based revalidation in addition to the EventSource connection.\n * @defaultValue `false`\n */\n revalidate?: number | false\n }\n /**\n * Optional. Include stega encoding when draft mode is enabled.\n * @defaultValue `true`\n */\n stega?: boolean\n}\n\n/**\n * @public\n */\nexport function defineLive(config: DefineSanityLiveOptions): {\n /**\n * Use this function to fetch data from Sanity in your React Server Components.\n * @public\n */\n sanityFetch: DefinedSanityFetchType\n /**\n * Render this in your root layout.tsx to make your page revalidate on new content live, automatically.\n * @public\n */\n SanityLive: React.ComponentType<DefinedSanityLiveProps>\n /**\n * @alpha experimental, it may change or even be removed at any time\n */\n SanityLiveStream: DefinedSanityLiveStreamType\n} {\n const {\n client: _client,\n serverToken,\n browserToken,\n fetchOptions,\n stega: stegaEnabled = true,\n } = config\n\n if (!_client) {\n throw new Error('`client` is required for `defineLive` to function')\n }\n\n if (process.env.NODE_ENV !== 'production' && !serverToken && serverToken !== false) {\n console.warn(\n 'No `serverToken` provided to `defineLive`. This means that only published content will be fetched and respond to live events. You can silence this warning by setting `serverToken: false`.',\n )\n }\n\n if (process.env.NODE_ENV !== 'production' && !browserToken && browserToken !== false) {\n console.warn(\n 'No `browserToken` provided to `defineLive`. This means that live previewing drafts will only work when using the Presentation Tool in your Sanity Studio. To support live previewing drafts stand-alone, provide a `browserToken`. It is shared with the browser so it should only have Viewer rights or lower. You can silence this warning by setting `browserToken: false`.',\n )\n }\n\n const client = _client.withConfig({allowReconfigure: false, useCdn: false})\n const {token: originalToken} = client.config()\n const studioUrlDefined = typeof client.config().stega.studioUrl !== 'undefined'\n\n const sanityFetch: DefinedSanityFetchType = async function sanityFetch<\n const QueryString extends string,\n >({\n query,\n params = {},\n stega: _stega,\n tags = [],\n perspective: _perspective,\n tag,\n requestTag = tag ?? 'next-loader.fetch',\n }: {\n query: QueryString\n params?: QueryParams | Promise<QueryParams>\n stega?: boolean\n tags?: string[]\n perspective?: Exclude<ClientPerspective, 'raw'>\n tag?: string\n requestTag?: string\n }) {\n const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled)\n const perspective = _perspective ?? (await resolveCookiePerspective())\n const useCdn = perspective === 'published'\n const revalidate =\n fetchOptions?.revalidate !== undefined\n ? fetchOptions.revalidate\n : process.env.NODE_ENV === 'production'\n ? false\n : undefined\n const isBuildPhase = process.env['NEXT_PHASE'] === PHASE_PRODUCTION_BUILD\n const cacheMode = useCdn && !isBuildPhase ? 'noStale' : undefined\n\n const {syncTags} = await client.fetch(query, await params, {\n filterResponse: false,\n perspective: perspective as ClientPerspective,\n stega: false,\n returnQuery: false,\n next: {revalidate, tags: [...tags, 'sanity:fetch-sync-tags']},\n useCdn,\n cacheMode,\n tag: [requestTag, 'fetch-sync-tags'].filter(Boolean).join('.'),\n })\n\n const cacheTags = [...tags, ...(syncTags?.map((tag) => `sanity:${tag}`) || [])]\n\n const {result, resultSourceMap} = await client.fetch(query, await params, {\n filterResponse: false,\n perspective: perspective as ClientPerspective,\n stega,\n token: perspective !== 'published' && serverToken ? serverToken : originalToken,\n next: {revalidate, tags: cacheTags},\n useCdn,\n cacheMode,\n tag: requestTag,\n })\n return {data: result, sourceMap: resultSourceMap || null, tags: cacheTags}\n }\n\n const SanityLive: React.ComponentType<DefinedSanityLiveProps> = async function SanityLive(props) {\n const {\n refreshOnMount,\n refreshOnFocus,\n refreshOnReconnect,\n tag,\n requestTag = tag,\n onError,\n onGoAway,\n intervalOnGoAway,\n revalidateSyncTags,\n waitFor,\n } = props\n const {projectId, dataset, apiHost, apiVersion, useProjectHostname, requestTagPrefix} =\n client.config()\n const {isEnabled: isDraftModeEnabled} = await draftMode()\n\n // Preconnect to the Live Event API origin, or at least prefetch the DNS if preconenct is not supported\n const {origin} = new URL(client.getUrl('', false))\n preconnect(origin)\n prefetchDNS(origin)\n\n return (\n <SanityLiveClientComponent\n projectId={projectId}\n dataset={dataset}\n apiHost={apiHost}\n apiVersion={apiVersion}\n useProjectHostname={useProjectHostname}\n requestTagPrefix={requestTagPrefix}\n requestTag={requestTag}\n token={typeof browserToken === 'string' && isDraftModeEnabled ? browserToken : undefined}\n draftModeEnabled={isDraftModeEnabled}\n draftModePerspective={await resolveCookiePerspective()}\n refreshOnMount={refreshOnMount}\n refreshOnFocus={refreshOnFocus}\n refreshOnReconnect={refreshOnReconnect}\n onError={onError}\n onGoAway={onGoAway}\n intervalOnGoAway={intervalOnGoAway}\n revalidateSyncTags={revalidateSyncTags}\n waitFor={waitFor}\n />\n )\n }\n\n const SanityLiveStream: DefinedSanityLiveStreamType = async function SanityLiveStream(props) {\n const {\n query,\n params,\n perspective: _perspective,\n stega: _stega,\n tags,\n children,\n tag,\n requestTag = tag ?? 'next-loader.live-stream.fetch',\n } = props\n const {\n data,\n sourceMap,\n tags: cacheTags,\n } = await sanityFetch({\n query,\n params,\n tags,\n perspective: _perspective,\n stega: _stega,\n requestTag,\n })\n const {isEnabled: isDraftModeEnabled} = await draftMode()\n\n if (isDraftModeEnabled) {\n const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled)\n const perspective = _perspective ?? (await resolveCookiePerspective())\n const {projectId, dataset} = client.config()\n return (\n <SanityLiveStreamClientComponent\n projectId={projectId}\n dataset={dataset}\n query={query}\n params={await params}\n perspective={perspective}\n stega={stega}\n initial={children({data, sourceMap, tags: cacheTags})}\n // oxlint-disable-next-line react/no-children-prop\n children={\n // oxlint-disable-next-line no-unsafe-type-assertion\n children as unknown as any\n }\n />\n )\n }\n\n return children({data, sourceMap, tags: cacheTags})\n }\n\n return {\n sanityFetch,\n SanityLive,\n SanityLiveStream,\n }\n}\n"],"mappings":";;;;;;;;;;;;;AASA,eAAsB,2BAAuE;AAC3F,SAAQ,MAAM,WAAW,EAAE,aACtB,MAAM,SAAS,EAAE,IAAI,sBAAsB,GAC1C,qBAAqB,MAAM,SAAS,EAAE,IAAI,sBAAsB,EAAE,OAAO,SAAS,GAClF,WACF;;;;;AC+KN,SAAgB,WAAW,QAezB;CACA,MAAM,EACJ,QAAQ,SACR,aACA,cACA,cACA,OAAO,eAAe,SACpB;AAEJ,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAoD;AAGtE,KAAI,QAAQ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M;MAAW,MAAM;MAAU,CAAC;KAInD;KAEF,CAAA;;AAIN,UAAO,SAAS;IAAC;IAAM;IAAW,MAAM;IAAU,CAAC;;EAOpD"}
1
+ {"version":3,"file":"live.js","names":[],"sources":["../src/live/resolveCookiePerspective.ts","../src/live/defineLive.tsx"],"sourcesContent":["import type {ClientPerspective} from '@sanity/client'\nimport {perspectiveCookieName} from '@sanity/preview-url-secret/constants'\nimport {cookies, draftMode} from 'next/headers'\n\nimport {sanitizePerspective} from './utils'\n\n/**\n * @internal\n */\nexport async function resolveCookiePerspective(): Promise<Exclude<ClientPerspective, 'raw'>> {\n return (await draftMode()).isEnabled\n ? (await cookies()).has(perspectiveCookieName)\n ? sanitizePerspective((await cookies()).get(perspectiveCookieName)?.value, 'drafts')\n : 'drafts'\n : 'published'\n}\n","import {\n type ClientPerspective,\n type ClientReturn,\n type ContentSourceMap,\n type LiveEventGoAway,\n type QueryParams,\n type SanityClient,\n type SyncTag,\n} from '@sanity/client'\nimport SanityLiveClientComponent from 'next-sanity/live/client-components/live'\nimport {PHASE_PRODUCTION_BUILD} from 'next/constants'\nimport {draftMode} from 'next/headers'\nimport {prefetchDNS, preconnect} from 'react-dom'\n\nimport {resolveCookiePerspective} from './resolveCookiePerspective'\n\n/**\n * @public\n */\nexport type DefinedSanityFetchType = <const QueryString extends string>(options: {\n query: QueryString\n params?: QueryParams | Promise<QueryParams>\n /**\n * Add custom `next.tags` to the underlying fetch request.\n * @see https://nextjs.org/docs/app/api-reference/functions/fetch#optionsnexttags\n * This can be used in conjunction with custom fallback revalidation strategies, as well as with custom Server Actions that mutate data and want to render with fresh data right away (faster than the Live Event latency).\n * @defaultValue `['sanity']`\n */\n tags?: string[]\n perspective?: Exclude<ClientPerspective, 'raw'>\n stega?: boolean\n /**\n * @deprecated use `requestTag` instead\n */\n tag?: never\n /**\n * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.\n * @see https://www.sanity.io/docs/reference-api-request-tags\n * @defaultValue 'next-loader.fetch'\n */\n requestTag?: string\n}) => Promise<{\n data: ClientReturn<QueryString>\n sourceMap: ContentSourceMap | null\n tags: string[]\n}>\n\n/**\n * @public\n */\nexport interface DefinedSanityLiveProps {\n /**\n * Automatic refresh of RSC when the component <SanityLive /> is mounted.\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `true`\n */\n refreshOnMount?: boolean\n /**\n * Automatically refresh when window gets focused\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `false` if draftMode().isEnabled, otherwise `true` if not inside an iframe\n */\n refreshOnFocus?: boolean\n /**\n * Automatically refresh when the browser regains a network connection (via navigator.onLine)\n * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched.\n * @defaultValue `true`\n */\n refreshOnReconnect?: boolean\n /**\n * Automatically refresh on an interval when the Live Event API emits a `goaway` event, which indicates that the connection is rejected or closed.\n * This typically happens if the connection limit is reached, or if the connection is idle for too long.\n * To disable this long polling fallback behavior set `intervalOnGoAway` to `false` or `0`.\n * You can also use `onGoAway` to handle the `goaway` event in your own way, and read the reason why the event was emitted.\n * @defaultValue `30_000` 30 seconds interval\n */\n intervalOnGoAway?: number | false\n\n /**\n * Delays events until after a Sanity Function has processed them and called the callback endpoint.\n * When omitted, events are delivered immediately.\n */\n waitFor?: 'function'\n\n /**\n * @deprecated use `requestTag` instead\n */\n tag?: never\n\n /**\n * This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.\n * @see https://www.sanity.io/docs/reference-api-request-tags\n * @defaultValue 'next-loader.live'\n */\n requestTag?: string\n\n /**\n * Handle errors from the Live Events subscription.\n * By default it's reported using `console.error`, you can override this prop to handle it in your own way.\n */\n onError?: (error: unknown) => void\n\n /**\n * Handle the `goaway` event if the connection is rejected/closed.\n * `event.reason` will be a string of why the event was emitted, for example `'connection limit reached'`.\n * When this happens the `<SanityLive />` will fallback to long polling with a default interval of 30 seconds, providing your own `onGoAway` handler does not change this behavior.\n * If you want to disable long polling set `intervalOnGoAway` to `false` or `0`.\n */\n onGoAway?: (event: LiveEventGoAway, intervalOnGoAway: number | false) => void\n\n /**\n * Override how cache tags are invalidated, you need to pass a server action here.\n * You can also pass a `use client` function here, and have `router.refresh()` be called if the promise resolves to `'refresh'`.\n */\n revalidateSyncTags?: (tags: SyncTag[]) => Promise<void | 'refresh'>\n}\n\n/**\n * @public\n */\nexport interface DefineSanityLiveOptions {\n /**\n * Required for `sanityFetch` and `SanityLive` to work\n */\n client: SanityClient\n /**\n * Optional. If provided then the token needs to have permissions to query documents with `drafts.` prefixes in order for `perspective: 'drafts'` to work.\n * This token is not shared with the browser.\n */\n serverToken?: string | false\n /**\n * Optional. This token is shared with the browser, and should only have access to query published documents.\n * It is used to setup a `Live Draft Content` EventSource connection, and enables live previewing drafts stand-alone, outside of Presentation Tool.\n */\n browserToken?: string | false\n /**\n * Fetch options used by `sanityFetch`\n * @deprecated this option is removed in the next major version, use `export const revalidate` on the `page.tsx` or `layout.tsx` instead\n */\n fetchOptions?: {\n /**\n * Optional, enables time based revalidation in addition to the EventSource connection.\n * @defaultValue `false`\n */\n revalidate?: number | false\n }\n /**\n * Optional. Include stega encoding when draft mode is enabled.\n * @defaultValue `true`\n */\n stega?: boolean\n}\n\n/**\n * @public\n */\nexport function defineLive(config: DefineSanityLiveOptions): {\n /**\n * Use this function to fetch data from Sanity in your React Server Components.\n * @public\n */\n sanityFetch: DefinedSanityFetchType\n /**\n * Render this in your root layout.tsx to make your page revalidate on new content live, automatically.\n * @public\n */\n SanityLive: React.ComponentType<DefinedSanityLiveProps>\n} {\n const {\n client: _client,\n serverToken,\n browserToken,\n fetchOptions,\n stega: stegaEnabled = true,\n } = config\n\n if (!_client) {\n throw new Error('`client` is required for `defineLive` to function')\n }\n\n if (process.env.NODE_ENV !== 'production' && !serverToken && serverToken !== false) {\n console.warn(\n 'No `serverToken` provided to `defineLive`. This means that only published content will be fetched and respond to live events. You can silence this warning by setting `serverToken: false`.',\n )\n }\n\n if (process.env.NODE_ENV !== 'production' && !browserToken && browserToken !== false) {\n console.warn(\n 'No `browserToken` provided to `defineLive`. This means that live previewing drafts will only work when using the Presentation Tool in your Sanity Studio. To support live previewing drafts stand-alone, provide a `browserToken`. It is shared with the browser so it should only have Viewer rights or lower. You can silence this warning by setting `browserToken: false`.',\n )\n }\n\n const client = _client.withConfig({allowReconfigure: false, useCdn: false})\n const {token: originalToken} = client.config()\n const studioUrlDefined = typeof client.config().stega.studioUrl !== 'undefined'\n\n const sanityFetch: DefinedSanityFetchType = async function sanityFetch<\n const QueryString extends string,\n >({\n query,\n params = {},\n stega: _stega,\n tags = [],\n perspective: _perspective,\n tag,\n requestTag = tag ?? 'next-loader.fetch',\n }: {\n query: QueryString\n params?: QueryParams | Promise<QueryParams>\n stega?: boolean\n tags?: string[]\n perspective?: Exclude<ClientPerspective, 'raw'>\n tag?: string\n requestTag?: string\n }) {\n const stega = _stega ?? (stegaEnabled && studioUrlDefined && (await draftMode()).isEnabled)\n const perspective = _perspective ?? (await resolveCookiePerspective())\n const useCdn = perspective === 'published'\n const revalidate =\n fetchOptions?.revalidate !== undefined\n ? fetchOptions.revalidate\n : process.env.NODE_ENV === 'production'\n ? false\n : undefined\n const isBuildPhase = process.env['NEXT_PHASE'] === PHASE_PRODUCTION_BUILD\n const cacheMode = useCdn && !isBuildPhase ? 'noStale' : undefined\n\n const {syncTags} = await client.fetch(query, await params, {\n filterResponse: false,\n perspective: perspective as ClientPerspective,\n stega: false,\n returnQuery: false,\n next: {revalidate, tags: [...tags, 'sanity:fetch-sync-tags']},\n useCdn,\n cacheMode,\n tag: [requestTag, 'fetch-sync-tags'].filter(Boolean).join('.'),\n })\n\n const cacheTags = [...tags, ...(syncTags?.map((tag) => `sanity:${tag}`) || [])]\n\n const {result, resultSourceMap} = await client.fetch(query, await params, {\n filterResponse: false,\n perspective: perspective as ClientPerspective,\n stega,\n token: perspective !== 'published' && serverToken ? serverToken : originalToken,\n next: {revalidate, tags: cacheTags},\n useCdn,\n cacheMode,\n tag: requestTag,\n })\n return {data: result, sourceMap: resultSourceMap || null, tags: cacheTags}\n }\n\n const SanityLive: React.ComponentType<DefinedSanityLiveProps> = async function SanityLive(props) {\n const {\n refreshOnMount,\n refreshOnFocus,\n refreshOnReconnect,\n tag,\n requestTag = tag,\n onError,\n onGoAway,\n intervalOnGoAway,\n revalidateSyncTags,\n waitFor,\n } = props\n const {projectId, dataset, apiHost, apiVersion, useProjectHostname, requestTagPrefix} =\n client.config()\n const {isEnabled: isDraftModeEnabled} = await draftMode()\n\n // Preconnect to the Live Event API origin, or at least prefetch the DNS if preconenct is not supported\n const {origin} = new URL(client.getUrl('', false))\n preconnect(origin)\n prefetchDNS(origin)\n\n return (\n <SanityLiveClientComponent\n projectId={projectId}\n dataset={dataset}\n apiHost={apiHost}\n apiVersion={apiVersion}\n useProjectHostname={useProjectHostname}\n requestTagPrefix={requestTagPrefix}\n requestTag={requestTag}\n token={typeof browserToken === 'string' && isDraftModeEnabled ? browserToken : undefined}\n draftModeEnabled={isDraftModeEnabled}\n draftModePerspective={await resolveCookiePerspective()}\n refreshOnMount={refreshOnMount}\n refreshOnFocus={refreshOnFocus}\n refreshOnReconnect={refreshOnReconnect}\n onError={onError}\n onGoAway={onGoAway}\n intervalOnGoAway={intervalOnGoAway}\n revalidateSyncTags={revalidateSyncTags}\n waitFor={waitFor}\n />\n )\n }\n\n return {\n sanityFetch,\n SanityLive,\n }\n}\n"],"mappings":";;;;;;;;;;;;AASA,eAAsB,2BAAuE;AAC3F,SAAQ,MAAM,WAAW,EAAE,aACtB,MAAM,SAAS,EAAE,IAAI,sBAAsB,GAC1C,qBAAqB,MAAM,SAAS,EAAE,IAAI,sBAAsB,EAAE,OAAO,SAAS,GAClF,WACF;;;;;AC8IN,SAAgB,WAAW,QAWzB;CACA,MAAM,EACJ,QAAQ,SACR,aACA,cACA,cACA,OAAO,eAAe,SACpB;AAEJ,KAAI,CAAC,QACH,OAAM,IAAI,MAA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ACH;IACb;IACA,OAAO,gBAAgB,eAAe,cAAc,cAAc;IAClE,MAAM;KAAC;KAAY,MAAM;KAAU;IACnC;IACA;IACA,KAAK;IACN,CAAC;AACF,UAAO;IAAC,MAAM;IAAQ,WAAW,mBAAmB;IAAM,MAAM;IAAU;;EAmD1E,YAAA,eAhD6E,WAAW,OAAO;GAC/F,MAAM,EACJ,gBACA,gBACA,oBACA,KACA,aAAa,KACb,SACA,UACA,kBACA,oBACA,YACE;GACJ,MAAM,EAAC,WAAW,SAAS,SAAS,YAAY,oBAAoB,qBAClE,OAAO,QAAQ;GACjB,MAAM,EAAC,WAAW,uBAAsB,MAAM,WAAW;GAGzD,MAAM,EAAC,WAAU,IAAI,IAAI,OAAO,OAAO,IAAI,MAAM,CAAC;AAClD,cAAW,OAAO;AAClB,eAAY,OAAO;AAEnB,UACE,oBAAC,2BAAD;IACa;IACF;IACA;IACG;IACQ;IACF;IACN;IACZ,OAAO,OAAO,iBAAiB,YAAY,qBAAqB,eAAe,KAAA;IAC/E,kBAAkB;IAClB,sBAAsB,MAAM,0BAA0B;IACtC;IACA;IACI;IACX;IACC;IACQ;IACE;IACX;IACT,CAAA;;EAOL"}
@@ -1,12 +1,11 @@
1
1
  import { t as isCorsOriginError } from "./isCorsOriginError.js";
2
- import { i as DefinedSanityLiveStreamType, n as DefinedSanityFetchType, r as DefinedSanityLiveProps, t as DefineSanityLiveOptions } from "./defineLive.js";
2
+ import { n as DefinedSanityFetchType, r as DefinedSanityLiveProps, t as DefineSanityLiveOptions } from "./defineLive.js";
3
3
  /**
4
4
  * @public
5
5
  */
6
6
  declare function defineLive(_config: DefineSanityLiveOptions): {
7
7
  sanityFetch: DefinedSanityFetchType;
8
8
  SanityLive: React.ComponentType<DefinedSanityLiveProps>;
9
- SanityLiveStream: DefinedSanityLiveStreamType;
10
9
  };
11
- export { type DefineSanityLiveOptions, type DefinedSanityFetchType, type DefinedSanityLiveProps, type DefinedSanityLiveStreamType, defineLive, isCorsOriginError };
10
+ export { type DefineSanityLiveOptions, type DefinedSanityFetchType, type DefinedSanityLiveProps, defineLive, isCorsOriginError };
12
11
  //# sourceMappingURL=live.server-only.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"live.server-only.d.ts","names":[],"sources":["../src/live.server-only.ts"],"mappings":";;;;AAUA;iBAAgB,UAAA,CAAW,OAAA,EAAS,uBAAA;EAClC,WAAA,EAAa,sBAAA;EACb,UAAA,EAAY,KAAA,CAAM,aAAA,CAAc,sBAAA;EAChC,gBAAA,EAAkB,2BAAA;AAAA"}
1
+ {"version":3,"file":"live.server-only.d.ts","names":[],"sources":["../src/live.server-only.ts"],"mappings":";;;;AASA;iBAAgB,UAAA,CAAW,OAAA,EAAS,uBAAA;EAClC,WAAA,EAAa,sBAAA;EACb,UAAA,EAAY,KAAA,CAAM,aAAA,CAAc,sBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"live.server-only.js","names":[],"sources":["../src/live.server-only.ts"],"sourcesContent":["import type {\n DefineSanityLiveOptions,\n DefinedSanityFetchType,\n DefinedSanityLiveProps,\n DefinedSanityLiveStreamType,\n} from './live/defineLive'\n\n/**\n * @public\n */\nexport function defineLive(_config: DefineSanityLiveOptions): {\n sanityFetch: DefinedSanityFetchType\n SanityLive: React.ComponentType<DefinedSanityLiveProps>\n SanityLiveStream: DefinedSanityLiveStreamType\n} {\n throw new Error('defineLive can only be used in React Server Components')\n}\n\n/**\n * @public\n */\nexport type {\n DefineSanityLiveOptions,\n DefinedSanityFetchType,\n DefinedSanityLiveProps,\n DefinedSanityLiveStreamType,\n}\n\n// @TODO deprecate, so that we can simplify this branching and just use `import 'server-only'` instead\nexport {isCorsOriginError} from './isCorsOriginError'\n"],"mappings":";;;;AAUA,SAAgB,WAAW,SAIzB;AACA,OAAM,IAAI,MAAM,yDAAyD"}
1
+ {"version":3,"file":"live.server-only.js","names":[],"sources":["../src/live.server-only.ts"],"sourcesContent":["import type {\n DefineSanityLiveOptions,\n DefinedSanityFetchType,\n DefinedSanityLiveProps,\n} from './live/defineLive'\n\n/**\n * @public\n */\nexport function defineLive(_config: DefineSanityLiveOptions): {\n sanityFetch: DefinedSanityFetchType\n SanityLive: React.ComponentType<DefinedSanityLiveProps>\n} {\n throw new Error('defineLive can only be used in React Server Components')\n}\n\n/**\n * @public\n */\nexport type {\n DefineSanityLiveOptions,\n DefinedSanityFetchType,\n DefinedSanityLiveProps,\n}\n\n// @TODO deprecate, so that we can simplify this branching and just use `import 'server-only'` instead\nexport {isCorsOriginError} from './isCorsOriginError'\n"],"mappings":";;;;AASA,SAAgB,WAAW,SAGzB;AACA,OAAM,IAAI,MAAM,yDAAyD"}
@@ -1,6 +1,6 @@
1
1
  "use server";
2
- import { draftMode } from "next/headers.js";
3
- import { revalidatePath } from "next/cache.js";
2
+ import { draftMode } from "next/headers";
3
+ import { revalidatePath } from "next/cache";
4
4
  async function revalidateRootLayout() {
5
5
  if (!(await draftMode()).isEnabled) {
6
6
  console.warn("Skipped revalidatePath request because draft mode is not enabled");
@@ -1,4 +1,4 @@
1
- import { NextRequest } from "next/server.js";
1
+ import { NextRequest } from "next/server";
2
2
  /** @public */
3
3
  type ParsedBody<T> = {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "12.3.1",
3
+ "version": "12.3.3",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "live",
@@ -45,7 +45,6 @@
45
45
  "default": "./dist/live.server-only.js"
46
46
  },
47
47
  "./live/client-components/live": "./dist/live/client-components/live/index.js",
48
- "./live/client-components/live-stream": "./dist/live/client-components/live-stream/index.js",
49
48
  "./live/server-actions": "./dist/live/server-actions/index.js",
50
49
  "./studio": "./dist/studio/index.js",
51
50
  "./studio/client-component": "./dist/studio/client-component/index.js",
@@ -64,7 +63,7 @@
64
63
  "@sanity/visual-editing": "^5.3.4",
65
64
  "@sanity/webhook": "^4.0.4",
66
65
  "dequal": "^2.0.3",
67
- "groq": "^5.22.0",
66
+ "groq": "^5.23.0",
68
67
  "history": "^5.3.0",
69
68
  "server-only": "^0.0.1"
70
69
  },
@@ -77,7 +76,7 @@
77
76
  "@vitejs/plugin-react": "^6.0.1",
78
77
  "@vitest/coverage-v8": "^4.1.5",
79
78
  "js-yaml": "^4.1.1",
80
- "next": "16.3.0-canary.2",
79
+ "next": "16.3.0-canary.5",
81
80
  "publint": "^0.3.18",
82
81
  "react": "^19.2.5",
83
82
  "react-dom": "^19.2.5",
@@ -85,7 +84,7 @@
85
84
  "tsdown": "^0.21.10",
86
85
  "typedoc": "^0.28.19",
87
86
  "typescript": "5.9.3",
88
- "vite": "^8.0.0",
87
+ "vite": "^8.0.10",
89
88
  "vitest": "^4.1.5",
90
89
  "vitest-package-exports": "^1.2.0"
91
90
  },
@@ -94,7 +93,7 @@
94
93
  "next": "^16.0.0-0",
95
94
  "react": "^19.2.3",
96
95
  "react-dom": "^19.2.3",
97
- "sanity": "^5.22.0",
96
+ "sanity": "^5.23.0",
98
97
  "styled-components": "^6.1"
99
98
  },
100
99
  "engines": {
@@ -1,72 +0,0 @@
1
- import { r as comlinkListeners, t as comlink } from "./context.js";
2
- import { use, useCallback, useEffect, useEffectEvent, useState, useSyncExternalStore } from "react";
3
- import { stegaEncodeSourceMap } from "@sanity/client/stega";
4
- import { dequal } from "dequal/lite";
5
- import { Fragment, jsx } from "react/jsx-runtime";
6
- import "@sanity/client";
7
- const LISTEN_HEARTBEAT_INTERVAL = 1e4;
8
- /**
9
- * @public
10
- */
11
- function SanityLiveStream(props) {
12
- const { query, dataset, params = {}, perspective, projectId, stega } = props;
13
- const comlink$1 = useSyncExternalStore(useCallback((listener) => {
14
- comlinkListeners.add(listener);
15
- return () => comlinkListeners.delete(listener);
16
- }, []), () => comlink, () => null);
17
- const [children, setChildren] = useState(void 0);
18
- const handleQueryHeartbeat = useEffectEvent((comlink) => {
19
- comlink.post("loader/query-listen", {
20
- projectId,
21
- dataset,
22
- perspective,
23
- query,
24
- params,
25
- heartbeat: LISTEN_HEARTBEAT_INTERVAL
26
- });
27
- });
28
- const handleQueryChange = useEffectEvent((event) => {
29
- if (dequal({
30
- projectId,
31
- dataset,
32
- query,
33
- params
34
- }, {
35
- projectId: event.projectId,
36
- dataset: event.dataset,
37
- query: event.query,
38
- params: event.params
39
- })) {
40
- const { result, resultSourceMap, tags } = event;
41
- const data = stega ? stegaEncodeSourceMap(result, resultSourceMap, {
42
- enabled: true,
43
- studioUrl: "/"
44
- }) : result;
45
- console.groupCollapsed("rendering with server action");
46
- props.children({
47
- data,
48
- sourceMap: resultSourceMap,
49
- tags: tags || []
50
- }).then((children) => {
51
- console.log("setChildren(children)");
52
- setChildren(children);
53
- }, (reason) => {
54
- console.error("rendering with server action: render children error", reason);
55
- }).finally(() => console.groupEnd());
56
- }
57
- });
58
- useEffect(() => {
59
- if (!comlink$1) return;
60
- const unsubscribe = comlink$1.on("loader/query-change", handleQueryChange);
61
- const interval = setInterval(() => handleQueryHeartbeat(comlink$1), LISTEN_HEARTBEAT_INTERVAL);
62
- return () => {
63
- clearInterval(interval);
64
- unsubscribe();
65
- };
66
- }, [comlink$1]);
67
- if (!comlink$1 || children === void 0) return use(props.initial);
68
- return /* @__PURE__ */ jsx(Fragment, { children });
69
- }
70
- export { SanityLiveStream as default };
71
-
72
- //# sourceMappingURL=SanityLiveStream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SanityLiveStream.js","names":["comlink","comlinkSnapshot"],"sources":["../src/live/client-components/live-stream/SanityLiveStream.tsx"],"sourcesContent":["// oxlint-disable no-unsafe-type-assertion\nimport {\n type ClientPerspective,\n type ContentSourceMap,\n type InitializedClientConfig,\n type QueryParams,\n} from '@sanity/client'\nimport {stegaEncodeSourceMap} from '@sanity/client/stega'\nimport type {LoaderControllerMsg} from '@sanity/presentation-comlink'\nimport {dequal} from 'dequal/lite'\nimport {use, useCallback, useEffect, useState, useSyncExternalStore, useEffectEvent} from 'react'\n\nimport {comlinkListeners, comlink as comlinkSnapshot} from '../../hooks/context'\n\n/**\n * @public\n */\nexport interface SanityLiveStreamProps extends Pick<\n InitializedClientConfig,\n 'projectId' | 'dataset'\n> {\n query: string\n params?: QueryParams\n perspective?: Exclude<ClientPerspective, 'raw'>\n stega?: boolean\n initial: Promise<React.ReactNode>\n children: (result: {\n data: unknown\n sourceMap: ContentSourceMap | null\n tags: string[]\n }) => Promise<React.ReactNode>\n}\n\nconst LISTEN_HEARTBEAT_INTERVAL = 10_000\n\n/**\n * @public\n */\nexport default function SanityLiveStream(props: SanityLiveStreamProps): React.JSX.Element | null {\n const {query, dataset, params = {}, perspective, projectId, stega} = props\n\n const subscribe = useCallback((listener: () => void) => {\n comlinkListeners.add(listener)\n return () => comlinkListeners.delete(listener)\n }, [])\n\n const comlink = useSyncExternalStore(\n subscribe,\n () => comlinkSnapshot,\n () => null,\n )\n const [children, setChildren] = useState<React.ReactNode | undefined>(undefined)\n\n const handleQueryHeartbeat = useEffectEvent((comlink: NonNullable<typeof comlinkSnapshot>) => {\n comlink.post('loader/query-listen', {\n projectId: projectId!,\n dataset: dataset!,\n perspective: perspective! as ClientPerspective,\n query,\n params: params,\n heartbeat: LISTEN_HEARTBEAT_INTERVAL,\n })\n })\n const handleQueryChange = useEffectEvent(\n (event: Extract<LoaderControllerMsg, {type: 'loader/query-change'}>['data']) => {\n if (\n dequal(\n {\n projectId,\n dataset,\n query,\n params,\n },\n {\n projectId: event.projectId,\n dataset: event.dataset,\n query: event.query,\n params: event.params,\n },\n )\n ) {\n const {result, resultSourceMap, tags} = event\n const data = stega\n ? stegaEncodeSourceMap(result, resultSourceMap, {enabled: true, studioUrl: '/'})\n : result\n // console.log('server function streaming is disabled', {\n // startTransition,\n // setPromise,\n // data,\n // resultSourceMap,\n // tags,\n // })\n // console.log('rendering with server action')\n // startTransition(() =>\n // setPromise(\n // props.children({\n // data,\n // sourceMap: resultSourceMap!,\n // tags: tags || [],\n // }) as Promise<React.JSX.Element>,\n // ),\n // )\n // oxlint-disable-next-line no-console\n console.groupCollapsed('rendering with server action')\n ;(\n props.children({\n data,\n sourceMap: resultSourceMap!,\n tags: tags || [],\n }) as Promise<React.JSX.Element>\n )\n .then(\n (children) => {\n // oxlint-disable-next-line no-console\n console.log('setChildren(children)')\n // startTransition(() => setChildren(children))\n setChildren(children)\n },\n (reason: unknown) => {\n console.error('rendering with server action: render children error', reason)\n },\n )\n // oxlint-disable-next-line no-console\n .finally(() => console.groupEnd())\n }\n },\n )\n useEffect(() => {\n if (!comlink) return\n\n const unsubscribe = comlink.on('loader/query-change', handleQueryChange)\n const interval = setInterval(() => handleQueryHeartbeat(comlink), LISTEN_HEARTBEAT_INTERVAL)\n return () => {\n clearInterval(interval)\n unsubscribe()\n }\n }, [comlink])\n\n if (!comlink || children === undefined) {\n return use(props.initial) as React.JSX.Element\n }\n\n return <>{children}</>\n}\n"],"mappings":";;;;;;AAiCA,MAAM,4BAA4B;;;;AAKlC,SAAwB,iBAAiB,OAAwD;CAC/F,MAAM,EAAC,OAAO,SAAS,SAAS,EAAE,EAAE,aAAa,WAAW,UAAS;CAOrE,MAAMA,YAAU,qBALE,aAAa,aAAyB;AACtD,mBAAiB,IAAI,SAAS;AAC9B,eAAa,iBAAiB,OAAO,SAAS;IAC7C,EAAE,CAGM,QACHC,eACA,KACP;CACD,MAAM,CAAC,UAAU,eAAe,SAAsC,KAAA,EAAU;CAEhF,MAAM,uBAAuB,gBAAgB,YAAiD;AAC5F,UAAQ,KAAK,uBAAuB;GACvB;GACF;GACI;GACb;GACQ;GACR,WAAW;GACZ,CAAC;GACF;CACF,MAAM,oBAAoB,gBACvB,UAA+E;AAC9E,MACE,OACE;GACE;GACA;GACA;GACA;GACD,EACD;GACE,WAAW,MAAM;GACjB,SAAS,MAAM;GACf,OAAO,MAAM;GACb,QAAQ,MAAM;GACf,CACF,EACD;GACA,MAAM,EAAC,QAAQ,iBAAiB,SAAQ;GACxC,MAAM,OAAO,QACT,qBAAqB,QAAQ,iBAAiB;IAAC,SAAS;IAAM,WAAW;IAAI,CAAC,GAC9E;AAmBJ,WAAQ,eAAe,+BAA+B;AAEpD,SAAM,SAAS;IACb;IACA,WAAW;IACX,MAAM,QAAQ,EAAE;IACjB,CAAC,CAED,MACE,aAAa;AAEZ,YAAQ,IAAI,wBAAwB;AAEpC,gBAAY,SAAS;OAEtB,WAAoB;AACnB,YAAQ,MAAM,uDAAuD,OAAO;KAE/E,CAEA,cAAc,QAAQ,UAAU,CAAC;;GAGzC;AACD,iBAAgB;AACd,MAAI,CAACD,UAAS;EAEd,MAAM,cAAcA,UAAQ,GAAG,uBAAuB,kBAAkB;EACxE,MAAM,WAAW,kBAAkB,qBAAqBA,UAAQ,EAAE,0BAA0B;AAC5F,eAAa;AACX,iBAAc,SAAS;AACvB,gBAAa;;IAEd,CAACA,UAAQ,CAAC;AAEb,KAAI,CAACA,aAAW,aAAa,KAAA,EAC3B,QAAO,IAAI,MAAM,QAAQ;AAG3B,QAAO,oBAAA,UAAA,EAAG,UAAY,CAAA"}
@@ -1,19 +0,0 @@
1
- import { ClientPerspective, ContentSourceMap, InitializedClientConfig, QueryParams } from "@sanity/client";
2
- /**
3
- * @public
4
- */
5
- interface SanityLiveStreamProps extends Pick<InitializedClientConfig, "projectId" | "dataset"> {
6
- query: string;
7
- params?: QueryParams;
8
- perspective?: Exclude<ClientPerspective, "raw">;
9
- stega?: boolean;
10
- initial: Promise<React.ReactNode>;
11
- children: (result: {
12
- data: unknown;
13
- sourceMap: ContentSourceMap | null;
14
- tags: string[];
15
- }) => Promise<React.ReactNode>;
16
- }
17
- declare function SanityLiveStreamLazyClientComponent(props: SanityLiveStreamProps): React.ReactNode;
18
- export { type SanityLiveStreamProps, SanityLiveStreamLazyClientComponent as default };
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/live/client-components/live-stream/SanityLiveStream.tsx","../../../../src/live/client-components/live-stream/SanityLiveStreamLazy.tsx"],"mappings":";;AAiBA;;UAAiB,qBAAA,SAA8B,IAAA,CAC7C,uBAAA;EAGA,KAAA;EACA,MAAA,GAAS,WAAA;EACT,WAAA,GAAc,OAAA,CAAQ,iBAAA;EACtB,KAAA;EACA,OAAA,EAAS,OAAA,CAAQ,KAAA,CAAM,SAAA;EACvB,QAAA,GAAW,MAAA;IACT,IAAA;IACA,SAAA,EAAW,gBAAA;IACX,IAAA;EAAA,MACI,OAAA,CAAQ,KAAA,CAAM,SAAA;AAAA;AAAA,iBClBN,mCAAA,CAAoC,KAAA,EAAO,qBAAA,GAAwB,KAAA,CAAM,SAAA"}
@@ -1,15 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import dynamic from "next/dynamic.js";
4
- /**
5
- * This file works around a new restriction in Next v15 where server components are not allowed
6
- * to use dynamic(() => import('...), {ssr: false})
7
- * only Client Components can set ssr: false.
8
- */
9
- const SanityLiveStreamClientComponent = dynamic(() => import("../../../SanityLiveStream.js"), { ssr: false });
10
- function SanityLiveStreamLazyClientComponent(props) {
11
- return /* @__PURE__ */ jsx(SanityLiveStreamClientComponent, { ...props });
12
- }
13
- export { SanityLiveStreamLazyClientComponent as default };
14
-
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/live/client-components/live-stream/SanityLiveStreamLazy.tsx"],"sourcesContent":["/**\n * This file works around a new restriction in Next v15 where server components are not allowed\n * to use dynamic(() => import('...), {ssr: false})\n * only Client Components can set ssr: false.\n */\n\nimport dynamic from 'next/dynamic'\n\nimport type {SanityLiveStreamProps} from './SanityLiveStream'\n\nconst SanityLiveStreamClientComponent = dynamic(() => import('./SanityLiveStream'), {ssr: false})\n\nexport function SanityLiveStreamLazyClientComponent(props: SanityLiveStreamProps): React.ReactNode {\n return <SanityLiveStreamClientComponent {...props} />\n}\n"],"mappings":";;;;;;;;AAUA,MAAM,kCAAkC,cAAc,OAAO,iCAAuB,EAAC,KAAK,OAAM,CAAC;AAEjG,SAAgB,oCAAoC,OAA+C;AACjG,QAAO,oBAAC,iCAAD,EAAiC,GAAI,OAAS,CAAA"}