1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.ApolloServerPluginLandingPageProductionDefault = exports.ApolloServerPluginLandingPageLocalDefault = void 0;
|
4 | function ApolloServerPluginLandingPageLocalDefault(options = {}) {
|
5 | const { version, __internal_apolloStudioEnv__, footer, ...rest } = options;
|
6 | return ApolloServerPluginLandingPageDefault(version, encodeConfig({
|
7 | isProd: false,
|
8 | apolloStudioEnv: __internal_apolloStudioEnv__,
|
9 | footer,
|
10 | ...rest,
|
11 | }));
|
12 | }
|
13 | exports.ApolloServerPluginLandingPageLocalDefault = ApolloServerPluginLandingPageLocalDefault;
|
14 | function ApolloServerPluginLandingPageProductionDefault(options = {}) {
|
15 | const { version, __internal_apolloStudioEnv__, footer, graphRef, ...rest } = options;
|
16 | return ApolloServerPluginLandingPageDefault(version, encodeConfig({
|
17 | isProd: true,
|
18 | apolloStudioEnv: __internal_apolloStudioEnv__,
|
19 | footer,
|
20 | graphRef,
|
21 | ...rest,
|
22 | }));
|
23 | }
|
24 | exports.ApolloServerPluginLandingPageProductionDefault = ApolloServerPluginLandingPageProductionDefault;
|
25 | function encodeConfig(config) {
|
26 | return JSON.stringify(encodeURIComponent(JSON.stringify(config)));
|
27 | }
|
28 | function ApolloServerPluginLandingPageDefault(maybeVersion, encodedConfig) {
|
29 | const version = maybeVersion !== null && maybeVersion !== void 0 ? maybeVersion : '_latest';
|
30 | return {
|
31 | __internal_installed_implicitly__: false,
|
32 | async serverWillStart() {
|
33 | return {
|
34 | async renderLandingPage() {
|
35 | const html = `
|
36 | <!DOCTYPE html>
|
37 | <html lang="en">
|
38 | <head>
|
39 | <meta charset="utf-8" />
|
40 | <link
|
41 | rel="icon"
|
42 | href="https://apollo-server-landing-page.cdn.apollographql.com/${version}/assets/favicon.png"
|
43 | />
|
44 | <meta name="viewport" content="width=device-width,initial-scale=1" />
|
45 | <link rel="preconnect" href="https://fonts.gstatic.com" />
|
46 | <link
|
47 | href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap"
|
48 | rel="stylesheet"
|
49 | />
|
50 | <meta name="theme-color" content="#000000" />
|
51 | <meta name="description" content="Apollo server landing page" />
|
52 | <link
|
53 | rel="apple-touch-icon"
|
54 | href="https://apollo-server-landing-page.cdn.apollographql.com/${version}/assets/favicon.png"
|
55 | />
|
56 | <link
|
57 | rel="manifest"
|
58 | href="https://apollo-server-landing-page.cdn.apollographql.com/${version}/manifest.json"
|
59 | />
|
60 | <title>Apollo Server</title>
|
61 | </head>
|
62 | <body style="margin: 0; overflow-x: hidden; overflow-y: hidden">
|
63 | <noscript>You need to enable JavaScript to run this app.</noscript>
|
64 | <div id="react-root">
|
65 | <style>
|
66 | .fallback {
|
67 | opacity: 0;
|
68 | animation: fadeIn 1s 1s;
|
69 | animation-iteration-count: 1;
|
70 | animation-fill-mode: forwards;
|
71 | padding: 1em;
|
72 | }
|
73 | @keyframes fadeIn {
|
74 | 0% {opacity:0;}
|
75 | 100% {opacity:1; }
|
76 | }
|
77 | </style>
|
78 | <div class="fallback">
|
79 | <h1>Welcome to Apollo Server</h1>
|
80 | <p>It appears that you might be offline. POST to this endpoint to query your graph:</p>
|
81 | <code style="white-space: pre;">
|
82 | curl --request POST \\
|
83 | --header 'content-type: application/json' \\
|
84 | --url '<script>document.write(window.location.href)</script>' \\
|
85 | --data '{"query":"query { __typename }"}'</code>
|
86 | </div>
|
87 | </div>
|
88 | <script>window.landingPage = ${encodedConfig};</script>
|
89 | <script src="https://apollo-server-landing-page.cdn.apollographql.com/${version}/static/js/main.js"></script>
|
90 | </body>
|
91 | </html>
|
92 | `;
|
93 | return { html };
|
94 | },
|
95 | };
|
96 | },
|
97 | };
|
98 | }
|
99 |
|
\ | No newline at end of file |