Skip to content

Commit d4c2913

Browse files
committed
Upgrade dependencies
1 parent 2300514 commit d4c2913

File tree

13 files changed

+57
-36
lines changed

13 files changed

+57
-36
lines changed

package.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"funding": "https://github.com/sindresorhus/got?sponsor=1",
88
"type": "module",
99
"exports": "./dist/source/index.js",
10+
"types": "./dist/source/index.d.ts",
1011
"engines": {
1112
"node": ">=14.16"
1213
},
@@ -44,27 +45,27 @@
4445
"ky"
4546
],
4647
"dependencies": {
47-
"@sindresorhus/is": "^4.6.0",
48+
"@sindresorhus/is": "^5.2.0",
4849
"@szmarczak/http-timer": "^5.0.1",
4950
"@types/cacheable-request": "^6.0.2",
5051
"@types/responselike": "^1.0.0",
5152
"cacheable-lookup": "^6.0.4",
5253
"cacheable-request": "^7.0.2",
5354
"decompress-response": "^6.0.0",
54-
"form-data-encoder": "1.7.1",
55+
"form-data-encoder": "^2.0.1",
5556
"get-stream": "^6.0.1",
5657
"http2-wrapper": "^2.1.10",
5758
"lowercase-keys": "^3.0.0",
5859
"p-cancelable": "^3.0.0",
5960
"responselike": "^2.0.0"
6061
},
6162
"devDependencies": {
62-
"@hapi/bourne": "^2.0.0",
63+
"@hapi/bourne": "^3.0.0",
6364
"@sindresorhus/tsconfig": "^2.0.0",
6465
"@sinonjs/fake-timers": "^9.1.1",
6566
"@types/benchmark": "^2.1.1",
6667
"@types/express": "^4.17.13",
67-
"@types/node": "^17.0.21",
68+
"@types/node": "^18.0.1",
6869
"@types/pem": "^1.9.6",
6970
"@types/pify": "^5.0.1",
7071
"@types/readable-stream": "^2.3.13",
@@ -73,7 +74,7 @@
7374
"@types/sinonjs__fake-timers": "^8.1.1",
7475
"@types/tough-cookie": "^4.0.1",
7576
"ava": "^3.15.0",
76-
"axios": "^0.26.1",
77+
"axios": "^0.27.2",
7778
"benchmark": "^2.1.4",
7879
"bluebird": "^3.7.2",
7980
"body-parser": "^1.19.2",
@@ -90,20 +91,19 @@
9091
"nyc": "^15.1.0",
9192
"p-event": "^5.0.1",
9293
"pem": "^1.14.6",
93-
"pify": "^5.0.0",
94-
"readable-stream": "^3.6.0",
94+
"pify": "^6.0.0",
95+
"readable-stream": "^4.0.0",
9596
"request": "^2.88.2",
96-
"sinon": "^13.0.1",
97+
"sinon": "^14.0.0",
9798
"slow-stream": "0.0.4",
98-
"tempy": "^2.0.0",
99+
"tempy": "^3.0.0",
99100
"then-busboy": "^5.1.1",
100101
"to-readable-stream": "^3.0.0",
101102
"tough-cookie": "^4.0.0",
102-
"ts-node": "^10.7.0",
103-
"typescript": "4.6.2",
104-
"xo": "^0.48.0"
103+
"ts-node": "^10.8.2",
104+
"typescript": "^4.7.4",
105+
"xo": "^0.50.0"
105106
},
106-
"types": "dist/source",
107107
"sideEffects": false,
108108
"ava": {
109109
"files": [
@@ -140,9 +140,9 @@
140140
],
141141
"rules": {
142142
"@typescript-eslint/no-empty-function": "off",
143-
"node/no-deprecated-api": "off",
144-
"node/prefer-global/url": "off",
145-
"node/prefer-global/url-search-params": "off",
143+
"n/no-deprecated-api": "off",
144+
"n/prefer-global/url": "off",
145+
"n/prefer-global/url-search-params": "off",
146146
"@typescript-eslint/no-implicit-any-catch": "off",
147147
"unicorn/prefer-node-protocol": "off",
148148
"ava/assertion-arguments": "off",
@@ -151,6 +151,7 @@
151151
"@typescript-eslint/no-unsafe-assignment": "off",
152152
"@typescript-eslint/no-unsafe-call": "off",
153153
"@typescript-eslint/await-thenable": "off",
154+
"@typescript-eslint/no-redundant-type-constituents": "off",
154155
"no-lone-blocks": "off",
155156
"unicorn/no-await-expression-member": "off"
156157
}

source/core/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import CacheableRequest from 'cacheable-request';
1010
import decompressResponse from 'decompress-response';
1111
import is from '@sindresorhus/is';
1212
import {buffer as getBuffer} from 'get-stream';
13-
import {FormDataEncoder, isFormDataLike} from 'form-data-encoder';
13+
import {FormDataEncoder, isFormData as isFormDataLike} from 'form-data-encoder';
1414
import type {ClientRequestWithTimings, Timings, IncomingMessageWithTimings} from '@szmarczak/http-timer';
1515
import type ResponseLike from 'responselike';
1616
import getBodySize from './utils/get-body-size.js';
@@ -56,6 +56,8 @@ export type GotEventFunction<T> =
5656
5757
@example
5858
```
59+
import got from 'got';
60+
5961
got.stream('https://github.com')
6062
.on('request', request => setTimeout(() => request.destroy(), 50));
6163
```
@@ -88,6 +90,8 @@ export type GotEventFunction<T> =
8890
8991
@example
9092
```
93+
import got from 'got';
94+
9195
const response = await got('https://sindresorhus.com')
9296
.on('downloadProgress', progress => {
9397
// Report download progress
@@ -138,6 +142,7 @@ type OptionsType = ConstructorParameters<typeof Options>[1];
138142
type DefaultsType = ConstructorParameters<typeof Options>[2];
139143

140144
export default class Request extends Duplex implements RequestEvents<Request> {
145+
// @ts-expect-error - Ignoring for now.
141146
override ['constructor']: typeof Request;
142147

143148
_noPipe?: boolean;

source/core/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import is, {assert} from '@sindresorhus/is';
2222
import lowercaseKeys from 'lowercase-keys';
2323
import CacheableLookup from 'cacheable-lookup';
2424
import http2wrapper, {ClientHttp2Session} from 'http2-wrapper';
25-
import {isFormDataLike} from 'form-data-encoder';
25+
import {isFormData} from 'form-data-encoder';
2626
import type {FormDataLike} from 'form-data-encoder';
2727
import type CacheableRequest from 'cacheable-request';
2828
import type ResponseLike from 'responselike';
@@ -35,7 +35,7 @@ import type {Delays} from './timed-out.js';
3535

3636
type Promisable<T> = T | Promise<T>;
3737

38-
const [major, minor] = process.versions.node.split('.').map(v => Number(v)) as [number, number, number];
38+
const [major, minor] = process.versions.node.split('.').map(Number) as [number, number, number];
3939

4040
export type DnsLookupIpVersion = undefined | 4 | 6;
4141

@@ -1304,7 +1304,7 @@ export default class Options {
13041304
}
13051305

13061306
set body(value: string | Buffer | Readable | Generator | AsyncGenerator | FormDataLike | undefined) {
1307-
assert.any([is.string, is.buffer, is.nodeStream, is.generator, is.asyncGenerator, isFormDataLike, is.undefined], value);
1307+
assert.any([is.string, is.buffer, is.nodeStream, is.generator, is.asyncGenerator, isFormData, is.undefined], value);
13081308

13091309
if (is.nodeStream(value)) {
13101310
assert.truthy(value.readable);

source/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export * from './core/response.js';
1919
export type {default as Request} from './core/index.js';
2020
export * from './core/index.js';
2121
export * from './core/errors.js';
22-
export {Delays} from './core/timed-out.js';
22+
export type {Delays} from './core/timed-out.js';
2323
export {default as calculateRetryDelay} from './core/calculate-retry-delay.js';
2424
export * from './as-promise/types.js';
2525
export * from './types.js';

source/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export interface GotPaginate {
102102
103103
@example
104104
```
105+
import got from 'got';
106+
105107
const countLimit = 10;
106108
107109
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
@@ -125,6 +127,8 @@ export interface GotPaginate {
125127
126128
@example
127129
```
130+
import got from 'got';
131+
128132
const countLimit = 10;
129133
130134
const results = await got.paginate.all('https://api.github.com/repos/sindresorhus/got/commits', {
@@ -219,6 +223,8 @@ export interface Got extends Record<HTTPAlias, GotRequestFunction>, GotRequestFu
219223
220224
@example
221225
```
226+
import got from 'got';
227+
222228
const countLimit = 10;
223229
224230
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
@@ -252,6 +258,8 @@ export interface Got extends Record<HTTPAlias, GotRequestFunction>, GotRequestFu
252258
253259
@example
254260
```
261+
import got from 'got';
262+
255263
const client = got.extend({
256264
prefixUrl: 'https://example.com',
257265
headers: {

test/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ test('works', withServer, async (t, server) => {
1313
response.end('not found');
1414
});
1515

16-
t.is((await got.get(server.url)).body, 'ok');
16+
const {body} = await got.get(server.url);
17+
t.is(body, 'ok');
1718

1819
const error = await t.throwsAsync<HTTPError>(got.get(`${server.url}/404`), {instanceOf: HTTPError});
1920
t.is(error.response.body, 'not found');

test/helpers/with-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import http from 'http';
22
import {promisify} from 'util';
33
import {ExecutionContext, Macro} from 'ava'; // eslint-disable-line ava/use-test
44
import is from '@sindresorhus/is';
5-
import tempy from 'tempy';
5+
import {temporaryFile} from 'tempy';
66
import FakeTimers from '@sinonjs/fake-timers';
77
import got, {Got, ExtendOptions} from '../../source/index.js';
88
import createHttpsTestServer, {ExtendedHttpsTestServer, HttpsServerOptions} from './create-https-test-server.js';
@@ -108,7 +108,7 @@ export const withHttpsServer = generateHttpsHook;
108108

109109
// TODO: Remove this when `create-test-server` supports custom listen.
110110
export const withSocketServer: Macro<[RunTestWithSocket]> = async (t, run) => {
111-
const socketPath = tempy.file({extension: 'socket'});
111+
const socketPath = temporaryFile({extension: 'socket'});
112112

113113
const server = http.createServer((request, response) => {
114114
server.emit(request.url!, request, response);

test/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ test('beforeRequest hook respect `url` option', withServer, async (t, server, go
10481048
hooks: {
10491049
beforeRequest: [
10501050
options => {
1051-
options.url = new URL(server.url + '/changed');
1051+
options.url = new URL(`${server.url}/changed`);
10521052
},
10531053
],
10541054
},

test/parse-link-header.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ test('works as expected', t => {
6262
reference: '/TheBook/chapter2',
6363
parameters: {
6464
rel: '"previous"',
65-
// eslint-disable-next-line @typescript-eslint/quotes
65+
// eslint-disable-next-line @typescript-eslint/quotes, @typescript-eslint/naming-convention
6666
'title*': `UTF-8'de'letztes%20Kapitel`,
6767
},
6868
},
6969
{
7070
reference: '/TheBook/chapter4',
7171
parameters: {
7272
rel: '"next"',
73-
// eslint-disable-next-line @typescript-eslint/quotes
73+
// eslint-disable-next-line @typescript-eslint/quotes, @typescript-eslint/naming-convention
7474
'title*': `UTF-8'de'n%c3%a4chstes%20Kapitel`,
7575
},
7676
},

test/post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {pEvent} from 'p-event';
1111
import {Handler} from 'express';
1212
import {parse, Body, BodyEntryPath, BodyEntryRawValue, isBodyFile} from 'then-busboy';
1313
import {FormData as FormDataNode, Blob, File} from 'formdata-node';
14-
import {fileFromPath} from 'formdata-node/file-from-path';
14+
import {fileFromPath} from 'formdata-node/file-from-path'; // eslint-disable-line n/file-extension-in-import
1515
import getStream from 'get-stream';
1616
import FormData from 'form-data';
1717
import toReadableStream from 'to-readable-stream';
@@ -346,7 +346,7 @@ test('body - sends files with spec-compliant FormData', withServer, async (t, se
346346
const fullPath = path.resolve('test/fixtures/ok');
347347
const blobContent = 'Blob content';
348348
const fileContent = 'File content';
349-
const anotherFileContent = await fsPromises.readFile(fullPath, 'utf-8');
349+
const anotherFileContent = await fsPromises.readFile(fullPath, 'utf8');
350350
const expected = {
351351
blob: blobContent,
352352
file: fileContent,

0 commit comments

Comments
 (0)