graphql-playground-html
Advanced tools
Comparing version 1.3.7-alpha.7 to 1.3.7-alpha.8
@@ -13,2 +13,2 @@ export interface MiddlewareOptions { | ||
} | ||
export declare function renderPlaygroundPage(options: RenderPageOptions): string; | ||
export declare function renderPlaygroundPage(options: RenderPageOptions): Promise<string>; |
@@ -53,21 +53,19 @@ "use strict"; | ||
var loading = get_loading_markup_1.default(); | ||
var config; | ||
var configPath; | ||
var configString; | ||
var folderName; | ||
// let env | ||
function init() { | ||
dotenv.config(); | ||
function renderPlaygroundPage(options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_1; | ||
var env, extendedOptions, config, configPath, configString, folderName; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
dotenv.config(); | ||
_a.label = 1; | ||
env = options.env || {}; | ||
extendedOptions = __assign({}, options, { canSaveConfig: false }); | ||
if (options.htmlTitle) { | ||
extendedOptions.title = options.htmlTitle; | ||
} | ||
if (!options.useGraphQLConfig) return [3 /*break*/, 2]; | ||
config = graphql_config_1.getGraphQLConfig().config; | ||
config = graphql_config_1.resolveEnvsInValues(config, env); | ||
return [4 /*yield*/, graphql_config_extension_graphcool_1.patchEndpointsToConfig(config, process.cwd(), env)]; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
config = graphql_config_1.getGraphQLConfig().config; | ||
config = graphql_config_1.resolveEnvsInValues(config, process.env); | ||
return [4 /*yield*/, graphql_config_extension_graphcool_1.patchEndpointsToConfig(config, process.cwd(), process.env)]; | ||
case 2: | ||
config = _a.sent(); | ||
@@ -77,7 +75,15 @@ configPath = graphql_config_1.findGraphQLConfigFile(process.cwd()); | ||
folderName = path.basename(process.cwd()); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
extendedOptions.folderName = options.workspaceName || folderName; | ||
extendedOptions.config = config; | ||
extendedOptions.configString = configString; | ||
_a.label = 2; | ||
case 2: | ||
if (options.subscriptionsEndpoint) { | ||
extendedOptions.subscriptionEndpoint = options.subscriptionsEndpoint; | ||
} | ||
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."); | ||
} | ||
return [2 /*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 <style type=\"text/css\">\n html {\n font-family: \"Open Sans\", sans-serif;\n overflow: hidden;\n }\n \n body {\n margin: 0;\n background: #172a3a;\n }\n \n .playgroundIn {\n -webkit-animation: playgroundIn 0.5s ease-out forwards;\n animation: playgroundIn 0.5s ease-out forwards;\n }\n \n @-webkit-keyframes playgroundIn {\n from {\n opacity: 0;\n -webkit-transform: translateY(10px);\n -ms-transform: translateY(10px);\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n -webkit-transform: translateY(0);\n -ms-transform: translateY(0);\n transform: translateY(0);\n }\n }\n \n @keyframes playgroundIn {\n from {\n opacity: 0;\n -webkit-transform: translateY(10px);\n -ms-transform: translateY(10px);\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n -webkit-transform: translateY(0);\n -ms-transform: translateY(0);\n transform: translateY(0);\n }\n }\n </style>\n " + loading.container + "\n <div id=\"root\" />\n <script type=\"text/javascript\">\n window.addEventListener('load', function (event) {\n " + loading.script + "\n \n const root = document.getElementById('root');\n root.classList.add('playgroundIn');\n \n GraphQLPlayground.init(root, " + JSON.stringify(extendedOptions, null, 2) + ")\n })\n </script>\n </body>\n </html>\n"]; | ||
} | ||
@@ -87,23 +93,3 @@ }); | ||
} | ||
init(); | ||
function renderPlaygroundPage(options) { | ||
var extendedOptions = __assign({}, options, { canSaveConfig: false }); | ||
if (options.htmlTitle) { | ||
extendedOptions.title = options.htmlTitle; | ||
} | ||
if (options.useGraphQLConfig) { | ||
extendedOptions.folderName = options.workspaceName || folderName; | ||
extendedOptions.config = config; | ||
extendedOptions.configString = configString; | ||
} | ||
if (options.subscriptionsEndpoint) { | ||
extendedOptions.subscriptionEndpoint = options.subscriptionsEndpoint; | ||
} | ||
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."); | ||
} | ||
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 <style type=\"text/css\">\n html {\n font-family: \"Open Sans\", sans-serif;\n overflow: hidden;\n }\n \n body {\n margin: 0;\n background: #172a3a;\n }\n \n .playgroundIn {\n -webkit-animation: playgroundIn 0.5s ease-out forwards;\n animation: playgroundIn 0.5s ease-out forwards;\n }\n \n @-webkit-keyframes playgroundIn {\n from {\n opacity: 0;\n -webkit-transform: translateY(10px);\n -ms-transform: translateY(10px);\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n -webkit-transform: translateY(0);\n -ms-transform: translateY(0);\n transform: translateY(0);\n }\n }\n \n @keyframes playgroundIn {\n from {\n opacity: 0;\n -webkit-transform: translateY(10px);\n -ms-transform: translateY(10px);\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n -webkit-transform: translateY(0);\n -ms-transform: translateY(0);\n transform: translateY(0);\n }\n }\n </style>\n " + loading.container + "\n <div id=\"root\" />\n <script type=\"text/javascript\">\n window.addEventListener('load', function (event) {\n " + loading.script + "\n \n const root = document.getElementById('root');\n root.classList.add('playgroundIn');\n \n GraphQLPlayground.init(root, " + JSON.stringify(extendedOptions, null, 2) + ")\n })\n </script>\n </body>\n </html>\n"; | ||
} | ||
exports.renderPlaygroundPage = renderPlaygroundPage; | ||
//# sourceMappingURL=render-playground-page.js.map |
{ | ||
"name": "graphql-playground-html", | ||
"version": "1.3.7-alpha.7", | ||
"version": "1.3.7-alpha.8", | ||
"homepage": | ||
@@ -5,0 +5,0 @@ "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-html", |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
3
27765
182