-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ApolloServerPluginLandingPageGraphQLPlayground to new package (#…
…6817) GraphQL Playground was unmaintained when we released Apollo Server 3, and the Apollo Server team has had to put significant work into fixing security issues in GraphQL Playground. While we will still publish a landing page plugin to enable folks upgrading from AS2 to not have to immediately retrain their users on how to use Apollo Sandbox or another interface, we remove it from the main `@apollo/server` package and move it to its own `@apollo/server-plugin-landing-page-graphql-playground` package. This lets us remove the Playground HTML package's dependencies (like `xss`) from Apollo Server's main package. Fixes #6109.
- Loading branch information
Showing
19 changed files
with
131 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@apollo/server-plugin-landing-page-graphql-playground": major | ||
"@apollo/server-integration-testsuite": patch | ||
"@apollo/server": patch | ||
--- | ||
|
||
Move ApolloServerPluginGraphQLPlayground into its own package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# GraphQL Playground plugin | ||
|
||
This is a plugin for Apollo Server 4 that makes your GraphQL server serve the [GraphQL Playground IDE](https://github.com/graphql/graphql-playground) as a landing page. | ||
|
||
GraphQL Playground was the only landing page available for Apollo Server 2. The GraphQL Playground project is officially [retired](https://github.com/graphql/graphql-playground/issues/1143) and we do not recommend its continued use. We recommend Apollo Server 4's default landing page, which serves the similar but actively maintained [Apollo Sandbox](https://www.apollographql.com/docs/studio/explorer/sandbox/), or a custom landing page. | ||
|
||
To help developers migrating from Apollo Server 2, we do still provide a landing page plugin that allows you to use GraphQL Playground with Apollo Server. In Apollo Server 3, that plugin is distributed as part of the `apollo-server-core` package. In Apollo Server 4, that plugin is distributed separately in this package. | ||
|
||
To use GraphQL Playground with Apollo Server 4, first `npm install @apollo/server-plugin-landing-page-graphql-playground`, and then: | ||
|
||
```ts | ||
import { ApolloServer } from '@apollo/server'; | ||
import { ApolloServerPluginLandingPageGraphQLPlayground } from '@apollo/server-plugin-landing-page-graphql-playground'; | ||
|
||
const server = new ApolloServer({ | ||
plugins: [ApolloServerPluginLandingPageGraphQLPlayground()], | ||
// ... other options ... | ||
}); | ||
``` | ||
|
||
Note that this will serve GraphQL Playground unconditionally. If you would prefer to only serve it when not in production, you can use `process.env.NODE_ENV` to determine whether to include the plugin in the `plugins` option yourself. |
37 changes: 37 additions & 0 deletions
37
packages/plugin-landing-page-graphql-playground/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "@apollo/server-plugin-landing-page-graphql-playground", | ||
"version": "3.0.0", | ||
"description": "Apollo Server landing page plugin for GraphQL Playground", | ||
"type": "module", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/esm/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/esm/index.d.ts", | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/apollographql/apollo-server", | ||
"directory": "packages/plugin-landing-page-graphql-playground" | ||
}, | ||
"keywords": [], | ||
"author": "Apollo <packages@apollographql.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/apollographql/apollo-server/issues" | ||
}, | ||
"homepage": "https://github.com/apollographql/apollo-server#readme", | ||
"engines": { | ||
"node": ">=14.0" | ||
}, | ||
"dependencies": { | ||
"@apollographql/graphql-playground-html": "1.6.29" | ||
}, | ||
"peerDependencies": { | ||
"@apollo/server": "^4.0.0-alpha.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/plugin-landing-page-graphql-playground/tsconfig.cjs.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": ".", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"outDir": "./dist/cjs", | ||
// We delete the CJS .d.ts files in postcompile so we don't need to | ||
// ever make their maps. (We can't disable creating the files because | ||
// this is a composite project.) | ||
"declarationMap": false, | ||
}, | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/plugin-landing-page-graphql-playground/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "../../tsconfig.base", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist/esm" | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["**/__tests__"], | ||
"references": [ | ||
{ | ||
"path": "../server" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
packages/server/plugin/landingPage/graphqlPlayground/package.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters