graphql-playground-middleware-express
Advanced tools
Comparing version 1.2.1-beta.3 to 1.2.1-beta.7
import { Request, Response } from 'express'; | ||
import { RenderPageOptions } from 'graphql-playground-middleware'; | ||
export declare type ExpressPlaygroundMiddleware = (req: Request, res: Response, next: () => void) => void; | ||
export declare type Register = (options: any) => ExpressPlaygroundMiddleware; | ||
export declare type Register = (options: RenderPageOptions) => ExpressPlaygroundMiddleware; | ||
declare const express: Register; | ||
export default express; |
@@ -11,3 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var render_playground_page_1 = require("./render-playground-page"); | ||
var graphql_playground_middleware_1 = require("graphql-playground-middleware"); | ||
/* tslint:disable */ | ||
@@ -19,3 +19,3 @@ var version = require('../package.json').version; | ||
res.setHeader('Content-Type', 'text/html'); | ||
res.write(render_playground_page_1.default(middlewareOptions)); | ||
res.write(graphql_playground_middleware_1.renderPlaygroundPage(middlewareOptions)); | ||
res.end(); | ||
@@ -22,0 +22,0 @@ next(); |
@@ -7,4 +7,3 @@ export interface MiddlewareOptions { | ||
folderName?: string; | ||
configString?: string; | ||
} | ||
export default function renderPlaygroundPage(options: MiddlewareOptions): string; |
@@ -11,4 +11,13 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
var findUp = require("find-up"); | ||
var configPath = findUp.sync(['.graphqlconfig', '.graphqlconfig.yml']); | ||
var configString = configPath | ||
? fs.readFileSync(configPath, 'utf-8') | ||
: undefined; | ||
var folderName = configPath ? path.dirname(configPath) : undefined; | ||
function renderPlaygroundPage(options) { | ||
var extendedOptions = __assign({}, options, { canSaveConfig: false }); | ||
var extendedOptions = __assign({}, options, { configString: configString, | ||
folderName: folderName, canSaveConfig: false }); | ||
return "\n<!DOCTYPE html>\n<html>\n<head>\n <meta charset=utf-8 />\n <meta name=\"viewport\" content=\"user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui\">\n <title>GraphQL Playground</title>\n <link rel=\"stylesheet\" href=\"//cdn.jsdelivr.net/npm/graphql-playground@" + options.version + "/build/static/css/index.css\" />\n <link rel=\"shortcut icon\" href=\"//cdn.jsdelivr.net/npm/graphql-playground@" + options.version + "/build/favicon.png\" />\n <script src=\"//cdn.jsdelivr.net/npm/graphql-playground@" + options.version + "/build/static/js/middleware.js\"></script>\n</head>\n<body>\n<div id=\"root\">\n <style>\n body {\n background-color: rgb(23,42,58);\n font-family: Open Sans,sans-serif;\n height: 90vh;\n }\n #root {\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .loading {\n font-size: 32px;\n font-weight: 200;\n color: rgba(255,255,255,.6);\n margin-left: 20px;\n }\n img {\n width: 78px;\n height: 78px;\n }\n .title {\n font-weight: 400;\n }\n </style>\n <img src='//cdn.jsdelivr.net/npm/graphql-playground/build/logo.png' alt=''>\n <div class=\"loading\">\n Loading <span class=\"title\">GraphQL Playground</span>\n </div>\n</div>\n <script>\n window.addEventListener('load', function(event) {\n GraphQLPlayground.init(document.getElementById('root'), " + JSON.stringify(extendedOptions, null, 2) + ")\n })\n </script>\n</body>\n</html>\n"; | ||
@@ -15,0 +24,0 @@ } |
{ | ||
"name": "graphql-playground-middleware-express", | ||
"version": "1.2.1-beta.3", | ||
"version": "1.2.1-beta.7", | ||
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-express", | ||
@@ -37,3 +37,6 @@ "description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).", | ||
"definition": "dist/index.d.ts" | ||
}, | ||
"dependencies": { | ||
"graphql-playground-middleware": "^1.2.1-beta.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6584
66
2
2
+ Addedfind-up@2.1.0(transitive)
+ Addedgraphql-playground-middleware@1.2.1-beta.6(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)