diff --git a/package.json b/package.json index 2ca870eb26cd9..ec664a09dcb7e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "@types/common-tags": "^1.8.0", "@types/express": "^4.17.3", "@types/fs-extra": "^8.1.2", - "@types/got": "^9.6.11", "@types/jaeger-client": "^3.18.0", "@types/jest": "^24.9.1", "@types/joi": "^14.3.4", diff --git a/packages/gatsby-core-utils/src/fetch-remote-file.ts b/packages/gatsby-core-utils/src/fetch-remote-file.ts index 3c92e286367b1..a0fcac9033357 100644 --- a/packages/gatsby-core-utils/src/fetch-remote-file.ts +++ b/packages/gatsby-core-utils/src/fetch-remote-file.ts @@ -1,4 +1,4 @@ -import got, { Options as GotOptions, Headers } from "got" +import got, { Headers, Options } from "got" import fileType from "file-type" import path from "path" import fs from "fs-extra" @@ -60,7 +60,7 @@ const requestRemoteNode = ( url: string | URL, headers: Headers, tmpFilename: string, - httpOptions?: GotOptions, + httpOptions?: Options, attempt: number = 1 ): Promise => new Promise((resolve, reject) => { @@ -182,14 +182,11 @@ export async function fetchRemoteFile({ headers[`If-None-Match`] = cachedHeaders.etag } - // Add Basic authentication if passed in: - // https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#username - // The "auth" API isn't particularly extensible, we should define an API that we validate - const httpOptions: got.GotOptions = {} + // Add htaccess authentication if passed in. This isn't particularly + // extensible. We should define a proper API that we validate. + const httpOptions: Options = {} if (auth && (auth.htaccess_pass || auth.htaccess_user)) { - // @ts-ignore - We use outdated @types/got typings. Once we update got everywhere we can remove @types/got and have correct typings httpOptions.username = auth.htaccess_user - // @ts-ignore - see above httpOptions.password = auth.htaccess_pass } diff --git a/yarn.lock b/yarn.lock index fe66fb627d7f0..f8da7e7254529 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4578,15 +4578,6 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/got@^9.6.11": - version "9.6.11" - resolved "https://registry.yarnpkg.com/@types/got/-/got-9.6.11.tgz#482b402cc5ee459481aeeadb08142ebb1a9afb26" - integrity sha512-dr3IiDNg5TDesGyuwTrN77E1Cd7DCdmCFtEfSGqr83jMMtcwhf/SGPbN2goY4JUWQfvxwY56+e5tjfi+oXeSdA== - dependencies: - "@types/node" "*" - "@types/tough-cookie" "*" - form-data "^2.5.0" - "@types/graceful-fs@^4.1.2": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" @@ -5044,11 +5035,6 @@ resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.0.tgz#e3f52b4d7397eaa9193592ef3fdd44dc0af4298c" integrity sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ== -"@types/tough-cookie@*": - version "2.3.5" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d" - integrity sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg== - "@types/uglify-js@*": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082"