UNPKG

next-sanity

Version:
48 lines (47 loc) 1.9 kB
import { createClient, unstable__adapter, unstable__environment } from "@sanity/client"; import { stegaClean } from "@sanity/client/stega"; import { createDataAttribute } from "@sanity/visual-editing/create-data-attribute"; import { jsx } from "react/jsx-runtime"; import VisualEditingComponent from "next-sanity/visual-editing/client-component"; export * from "@portabletext/react"; export * from "@sanity/next-loader"; import { defineQuery, default as default2 } from "groq"; function VisualEditing(props) { let autoBasePath; if (typeof props.basePath != "string") try { autoBasePath = process.env.__NEXT_ROUTER_BASEPATH, autoBasePath && console.log( `Detected next basePath as ${JSON.stringify(autoBasePath)} by reading "process.env.__NEXT_ROUTER_BASEPATH". If this is incorrect then you can set it manually with the basePath prop on the <VisualEditing /> component.` ); } catch (err) { console.error("Failed detecting basePath", err); } let autoTrailingSlash; if (typeof props.trailingSlash != "boolean") try { autoTrailingSlash = !!process.env.__NEXT_TRAILING_SLASH, autoTrailingSlash && console.log( `Detected next trailingSlash as ${JSON.stringify(autoTrailingSlash)} by reading "process.env.__NEXT_TRAILING_SLASH". If this is incorrect then you can set it manually with the trailingSlash prop on the <VisualEditing /> component.` ); } catch (err) { console.error("Failed detecting trailingSlash", err); } return /* @__PURE__ */ jsx( VisualEditingComponent, { ...props, basePath: props.basePath ?? autoBasePath, trailingSlash: props.trailingSlash ?? autoTrailingSlash } ); } export { VisualEditing, createClient, createDataAttribute, defineQuery, default2 as groq, stegaClean, unstable__adapter, unstable__environment }; //# sourceMappingURL=index.js.map