`. */
title?: string;
/** Pin `@eeeooolll/graphiql` to a specific version on the CDN. */
version?: string;
}
/**
* Renders the GraphiQL HTML shell.
*
* Loads the prebuilt IIFE bundle from `@eeeooolll/graphiql` (registered as
* `window.EolGraphiQL`) and mounts it against `endpoint`.
*
* Usually called indirectly via `GraphQLHTTP({ graphiql: true })`; invoke it
* directly if you need to embed GraphiQL in a custom route.
*/
export function renderPlaygroundPage(options: RenderPageOptions): string {
const {
cdnUrl = "//cdn.jsdelivr.net/npm",
endpoint = "/graphql",
faviconUrl,
title = "GraphiQL",
version
} = options;
const safeEndpoint = filter(endpoint);
const safeTitle = filter(title);
const scriptUrl = buildAssetUrl({ cdnUrl, suffix: "standalone.js", version });
const styleUrl = buildAssetUrl({ cdnUrl, suffix: "standalone.css", version });
const faviconLink =
faviconUrl === null ?
"" :
typeof faviconUrl === "string" ?
`` :
``;
return dedent`
${safeTitle}
${faviconLink}
`;
}