From 55219f5358ad708632e02c2bb42c5f242df1bc7a Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 28 Apr 2022 16:21:15 +0200 Subject: [PATCH] fix(fastify): use scoped modules --- package-lock.json | 254 +++++++++--------- packages/apollo-server-fastify/package.json | 6 +- .../apollo-server-fastify/src/ApolloServer.ts | 4 +- .../apollo-server-koa/src/ApolloServer.ts | 2 +- 4 files changed, 137 insertions(+), 129 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0b2e176d49..55dae84aaa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1878,6 +1878,18 @@ "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==", "dev": true }, + "node_modules/@fastify/accepts": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@fastify/accepts/-/accepts-3.0.0.tgz", + "integrity": "sha512-+ldBB3O59p/z9Uc1LSZqAA4/oZaNbRtCVMwjgJOahl+PKmx4ciRRoWVht77kFOb36lRE5MPEba4Vt78H7PKfQw==", + "dependencies": { + "accepts": "^1.3.5", + "fastify-plugin": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@fastify/ajv-compiler": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-1.1.0.tgz", @@ -1886,6 +1898,15 @@ "ajv": "^6.12.6" } }, + "node_modules/@fastify/cors": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-7.0.0.tgz", + "integrity": "sha512-nlo6ScwagBNJacAZD3KX90xjWLIoV0vN9QqoX1wUE9ZeZMdvkVkMZCGlxEtr00NshV0X5wDge4w5rwox7rRzSg==", + "dependencies": { + "fastify-plugin": "^3.0.0", + "vary": "^1.1.2" + } + }, "node_modules/@fastify/error": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-2.0.0.tgz", @@ -6927,7 +6948,8 @@ }, "node_modules/ajv": { "version": "6.12.6", - "license": "MIT", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -8848,9 +8870,9 @@ } }, "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "engines": { "node": ">= 0.6" } @@ -10210,14 +10232,6 @@ "node": ">= 0.10.0" } }, - "node_modules/express/node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/express/node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -10464,54 +10478,10 @@ "tiny-lru": "^8.0.1" } }, - "node_modules/fastify-accepts": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "accepts": "^1.3.5", - "fastify-plugin": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/fastify-cors": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/fastify-cors/-/fastify-cors-6.0.2.tgz", - "integrity": "sha512-sE0AOyzmj5hLLRRVgenjA6G2iOGX35/1S3QGYB9rr9TXelMZB3lFrXy4CzwYVOMiujJeMiLgO4J7eRm8sQSv8Q==", - "dependencies": { - "fastify-plugin": "^3.0.0", - "vary": "^1.1.2" - } - }, - "node_modules/fastify-cors/node_modules/fastify-plugin": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", - "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" - }, "node_modules/fastify-plugin": { - "version": "2.3.4", - "license": "MIT", - "dependencies": { - "semver": "^7.3.2" - } - }, - "node_modules/fastify-plugin/node_modules/semver": { - "version": "7.3.5", - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/fastify-warning": { - "version": "0.2.0", - "license": "MIT" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz", + "integrity": "sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==" }, "node_modules/fastify/node_modules/semver": { "version": "7.3.7", @@ -15297,16 +15267,36 @@ } }, "node_modules/light-my-request": { - "version": "4.4.1", - "license": "BSD-3-Clause", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.10.1.tgz", + "integrity": "sha512-l+zWk0HXGhGzY7IYTZnYEqIpj3Mpcyk2f8+FkKUyREywvaiWCf2jyQVxpasKRsploY/nVpoqTlxx72CIeQNcIQ==", "dependencies": { - "ajv": "^6.12.2", - "cookie": "^0.4.0", - "fastify-warning": "^0.2.0", - "readable-stream": "^3.6.0", + "ajv": "^8.1.0", + "cookie": "^0.5.0", + "process-warning": "^1.0.0", "set-cookie-parser": "^2.4.1" } }, + "node_modules/light-my-request/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/light-my-request/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, "node_modules/lines-and-columns": { "version": "1.1.6", "dev": true, @@ -18312,6 +18302,7 @@ }, "node_modules/readable-stream": { "version": "3.6.0", + "dev": true, "license": "MIT", "dependencies": { "inherits": "^2.0.3", @@ -18740,6 +18731,14 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -19549,6 +19548,7 @@ }, "node_modules/string_decoder": { "version": "1.1.1", + "dev": true, "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" @@ -20608,6 +20608,7 @@ }, "node_modules/util-deprecate": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/util-promisify": { @@ -21400,10 +21401,10 @@ "version": "3.6.7", "license": "MIT", "dependencies": { + "@fastify/accepts": "^3.0.0", + "@fastify/cors": "^7.0.0", "apollo-server-core": "file:../apollo-server-core", - "apollo-server-types": "file:../apollo-server-types", - "fastify-accepts": "^2.0.1", - "fastify-cors": "^6.0.0" + "apollo-server-types": "file:../apollo-server-types" }, "devDependencies": { "apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite" @@ -22934,6 +22935,15 @@ } } }, + "@fastify/accepts": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@fastify/accepts/-/accepts-3.0.0.tgz", + "integrity": "sha512-+ldBB3O59p/z9Uc1LSZqAA4/oZaNbRtCVMwjgJOahl+PKmx4ciRRoWVht77kFOb36lRE5MPEba4Vt78H7PKfQw==", + "requires": { + "accepts": "^1.3.5", + "fastify-plugin": "^3.0.0" + } + }, "@fastify/ajv-compiler": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-1.1.0.tgz", @@ -22942,6 +22952,15 @@ "ajv": "^6.12.6" } }, + "@fastify/cors": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-7.0.0.tgz", + "integrity": "sha512-nlo6ScwagBNJacAZD3KX90xjWLIoV0vN9QqoX1wUE9ZeZMdvkVkMZCGlxEtr00NshV0X5wDge4w5rwox7rRzSg==", + "requires": { + "fastify-plugin": "^3.0.0", + "vary": "^1.1.2" + } + }, "@fastify/error": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-2.0.0.tgz", @@ -26892,6 +26911,8 @@ }, "ajv": { "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -27080,11 +27101,11 @@ "apollo-server-fastify": { "version": "file:packages/apollo-server-fastify", "requires": { + "@fastify/accepts": "^3.0.0", + "@fastify/cors": "^7.0.0", "apollo-server-core": "file:../apollo-server-core", "apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite", - "apollo-server-types": "file:../apollo-server-types", - "fastify-accepts": "^2.0.1", - "fastify-cors": "^6.0.0" + "apollo-server-types": "file:../apollo-server-types" } }, "apollo-server-hapi": { @@ -28475,9 +28496,9 @@ } }, "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" }, "cookie-signature": { "version": "1.0.6" @@ -29455,11 +29476,6 @@ "vary": "~1.1.2" }, "dependencies": { - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" - }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -29654,45 +29670,10 @@ } } }, - "fastify-accepts": { - "version": "2.0.1", - "requires": { - "accepts": "^1.3.5", - "fastify-plugin": "^2.0.0" - } - }, - "fastify-cors": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/fastify-cors/-/fastify-cors-6.0.2.tgz", - "integrity": "sha512-sE0AOyzmj5hLLRRVgenjA6G2iOGX35/1S3QGYB9rr9TXelMZB3lFrXy4CzwYVOMiujJeMiLgO4J7eRm8sQSv8Q==", - "requires": { - "fastify-plugin": "^3.0.0", - "vary": "^1.1.2" - }, - "dependencies": { - "fastify-plugin": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", - "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" - } - } - }, "fastify-plugin": { - "version": "2.3.4", - "requires": { - "semver": "^7.3.2" - }, - "dependencies": { - "semver": { - "version": "7.3.5", - "requires": { - "lru-cache": "^6.0.0" - } - } - } - }, - "fastify-warning": { - "version": "0.2.0" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz", + "integrity": "sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==" }, "fastq": { "version": "1.11.0", @@ -33139,13 +33120,32 @@ } }, "light-my-request": { - "version": "4.4.1", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.10.1.tgz", + "integrity": "sha512-l+zWk0HXGhGzY7IYTZnYEqIpj3Mpcyk2f8+FkKUyREywvaiWCf2jyQVxpasKRsploY/nVpoqTlxx72CIeQNcIQ==", "requires": { - "ajv": "^6.12.2", - "cookie": "^0.4.0", - "fastify-warning": "^0.2.0", - "readable-stream": "^3.6.0", + "ajv": "^8.1.0", + "cookie": "^0.5.0", + "process-warning": "^1.0.0", "set-cookie-parser": "^2.4.1" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + } } }, "lines-and-columns": { @@ -35315,6 +35315,7 @@ }, "readable-stream": { "version": "3.6.0", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -35639,6 +35640,11 @@ "version": "2.1.1", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -36235,6 +36241,7 @@ }, "string_decoder": { "version": "1.1.1", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -36991,7 +36998,8 @@ "requires": {} }, "util-deprecate": { - "version": "1.0.2" + "version": "1.0.2", + "dev": true }, "util-promisify": { "version": "2.1.0", diff --git a/packages/apollo-server-fastify/package.json b/packages/apollo-server-fastify/package.json index ad96ad2cbf8..acf8254c6f5 100644 --- a/packages/apollo-server-fastify/package.json +++ b/packages/apollo-server-fastify/package.json @@ -26,10 +26,10 @@ "node": ">=12.0" }, "dependencies": { + "@fastify/accepts": "^3.0.0", + "@fastify/cors": "^7.0.0", "apollo-server-core": "file:../apollo-server-core", - "apollo-server-types": "file:../apollo-server-types", - "fastify-accepts": "^2.0.1", - "fastify-cors": "^6.0.0" + "apollo-server-types": "file:../apollo-server-types" }, "devDependencies": { "apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite" diff --git a/packages/apollo-server-fastify/src/ApolloServer.ts b/packages/apollo-server-fastify/src/ApolloServer.ts index 13df6f5aeb6..088fed05710 100644 --- a/packages/apollo-server-fastify/src/ApolloServer.ts +++ b/packages/apollo-server-fastify/src/ApolloServer.ts @@ -7,8 +7,8 @@ import { runHttpQuery, } from 'apollo-server-core'; import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'; -import accepts from 'fastify-accepts'; -import fastifyCors from 'fastify-cors'; +import accepts from '@fastify/accepts'; +import fastifyCors from '@fastify/cors'; export interface ServerRegistration { path?: string; diff --git a/packages/apollo-server-koa/src/ApolloServer.ts b/packages/apollo-server-koa/src/ApolloServer.ts index 1ceef742c41..241f0892442 100644 --- a/packages/apollo-server-koa/src/ApolloServer.ts +++ b/packages/apollo-server-koa/src/ApolloServer.ts @@ -98,7 +98,7 @@ export class ApolloServer extends ApolloServerBase { this.graphqlPath = path; if (cors === true || cors === undefined) { - // Unlike the express `cors` package, `fastify-cors`, or Hapi, Koa's cors + // Unlike the express `cors` package, `@fastify/cors`, or Hapi, Koa's cors // handling defaults to reflecting the incoming origin instead of '*'. // Let's make it match. middlewares.push(