diff --git a/deno.lock b/deno.lock index 337a03b..395af6b 100644 --- a/deno.lock +++ b/deno.lock @@ -95,6 +95,11 @@ "https://deno.land/std@0.129.0/testing/_diff.ts": "9d849cd6877694152e01775b2d93f9d6b7aef7e24bfe3bfafc4d7a1ac8e9f392", "https://deno.land/std@0.129.0/testing/asserts.ts": "0a95d9e8076dd3e7f0eeb605a67c148078b4b11f4abcd5eef115b0361b0736a2", "https://deno.land/std@0.197.0/fmt/colors.ts": "a7eecffdf3d1d54db890723b303847b6e0a1ab4b528ba6958b8f2e754cf1b3bc", + "https://deno.land/std@0.205.0/http/_negotiation/common.ts": "14d1a52427ab258a4b7161cd80e1d8a207b7cc64b46e911780f57ead5f4323c6", + "https://deno.land/std@0.205.0/http/_negotiation/encoding.ts": "ff747d107277c88cb7a6a62a08eeb8d56dad91564cbcccb30694d5dc126dcc53", + "https://deno.land/std@0.205.0/http/_negotiation/language.ts": "7bcddd8db3330bdb7ce4fc00a213c5547c1968139864201efd67ef2d0d51887d", + "https://deno.land/std@0.205.0/http/_negotiation/media_type.ts": "58847517cd549384ad677c0fe89e0a4815be36fe7a303ea63cee5f6a1d7e1692", + "https://deno.land/std@0.205.0/http/negotiation.ts": "46e74a6bad4b857333a58dc5b50fe8e5a4d5267e97292293ea65f980bd918086", "https://deno.land/std@0.205.0/http/status.ts": "1353e82e27996ef123dc625e5fcc9d66b94d92e5175879fa5e9f0dc39330206a", "https://deno.land/std@0.205.0/testing/_test_suite.ts": "30f018feeb3835f12ab198d8a518f9089b1bcb2e8c838a8b615ab10d5005465c", "https://deno.land/std@0.205.0/testing/bdd.ts": "3f446df5ef8e856a869e8eec54c8482590415741ff0b6358a00c43486cc15769", diff --git a/graphiql/README.md b/graphiql/README.md new file mode 100644 index 0000000..c282749 --- /dev/null +++ b/graphiql/README.md @@ -0,0 +1,26 @@ +# gql/graphiql + +[![][docs-badge]][docs] + +Tweaked version of +[graphql-playground-html](https://github.com/graphql/graphql-playground/tree/main/packages/graphql-playground-html) +without Electron and React environments. + +## Get Started + +```ts +import { renderPlaygroundPage } from 'https://deno.land/x/gql@2.0.0/graphiql/render.ts' + +const playground = renderPlaygroundPage({ + endpoint: '/graphql', +}) + +return new Response(playground, { + headers: new Headers({ + 'Content-Type': 'text/html', + }), +}) +``` + +[docs-badge]: https://img.shields.io/github/v/release/deno-libs/gql?label=Docs&logo=deno&style=for-the-badge&color=DD3FAA +[docs]: https://doc.deno.land/https/deno.land/x/gql/graphiql/render.ts diff --git a/graphiql/render.ts b/graphiql/render.ts index e724e34..cd45e65 100644 --- a/graphiql/render.ts +++ b/graphiql/render.ts @@ -5,8 +5,7 @@ export interface MiddlewareOptions { endpoint?: string subscriptionEndpoint?: string workspaceName?: string - env?: any - config?: any + config?: unknown settings?: ISettings schema?: IntrospectionResult tabs?: Tab[] @@ -63,7 +62,6 @@ export interface IntrospectionResult { export interface RenderPageOptions extends MiddlewareOptions { version?: string cdnUrl?: string - env?: any title?: string faviconUrl?: string | null } @@ -83,8 +81,6 @@ const CONFIG_ID = 'playground-config' const filter = (val: string) => { return filterXSS(val, { - // @ts-ignore - whiteList: [], stripIgnoreTag: true, stripIgnoreTagBody: ['script'], }) @@ -151,7 +147,6 @@ export function renderPlaygroundPage(options: RenderPageOptions) { extendedOptions.configString = JSON.stringify(options.config, null, 2) } if (!extendedOptions.endpoint && !extendedOptions.configString) { - /* tslint:disable-next-line */ console.warn( `WARNING: You didn't provide an endpoint and don't have a .graphqlconfig. Make sure you have at least one of them.`, ) @@ -167,11 +162,7 @@ export function renderPlaygroundPage(options: RenderPageOptions) {