/*** IMPORT ------------------------------------------- ***/ import { default as dedent } from "@netopwibby/dedent"; import { GRAPHIQL_VERSION } from "./version.ts"; /*** UTILITY ------------------------------------------ ***/ const escapeHtml = (value: string) => value .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll("\"", """) .replaceAll("'", "'"); const toScriptString = (value: string) => JSON.stringify(value).replaceAll("<", "\\u003c"); const buildAssetUrl = ({ cdnUrl, suffix, version }: { cdnUrl?: string; suffix: string; version: string; }) => cdnUrl ? `${cdnUrl}/@eeeooolll/graphiql@${version}/dist/${suffix}` : `./_graphiql/${GRAPHIQL_VERSION}/${suffix}`; /*** EXPORT ------------------------------------------- ***/ export interface RenderPageOptions { /** Load the bundle from this CDN base (e.g. `//cdn.jsdelivr.net/npm`) instead of the copy embedded in gq. */ cdnUrl?: string; /** GraphQL endpoint the embedded fetcher posts to. */ endpoint?: string; /** Optional ``. `null` skips, `undefined` falls back to default. */ faviconUrl?: string | null; /** Document `