Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Closes #2287
Closes #2286
  • Loading branch information
sindresorhus committed Jul 30, 2023
1 parent b1d61c1 commit 944caa8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
4 changes: 2 additions & 2 deletions source/as-promise/types.ts
@@ -1,8 +1,8 @@
import type {Buffer} from 'node:buffer';
import type PCancelable from 'p-cancelable';
import {RequestError} from '../core/errors.js';
import type Request from '../core/index.js';
import type {RequestEvents} from '../core/index.js';
import type Request from '../core/index.js'; // eslint-disable-line import/no-duplicates
import {type RequestEvents} from '../core/index.js'; // eslint-disable-line import/no-duplicates -- It's not allowed to combine these imports. The rule is incorrect.
import type {Response} from '../core/response.js';

/**
Expand Down
6 changes: 2 additions & 4 deletions source/core/index.ts
@@ -1,10 +1,9 @@
import process from 'node:process';
import {Buffer} from 'node:buffer';
import {Duplex, type Readable} from 'node:stream';
import http, {ServerResponse} from 'node:http';
import type {ClientRequest, RequestOptions} from 'node:http';
import http, {ServerResponse, type ClientRequest, type RequestOptions} from 'node:http';
import type {Socket} from 'node:net';
import timer from '@szmarczak/http-timer';
import timer, {type ClientRequestWithTimings, type Timings, type IncomingMessageWithTimings} from '@szmarczak/http-timer';
import CacheableRequest, {
CacheError as CacheableCacheError,
type StorageAdapter,
Expand All @@ -15,7 +14,6 @@ import decompressResponse from 'decompress-response';
import is from '@sindresorhus/is';
import getStream from 'get-stream';
import {FormDataEncoder, isFormData as isFormDataLike} from 'form-data-encoder';
import type {ClientRequestWithTimings, Timings, IncomingMessageWithTimings} from '@szmarczak/http-timer';
import type ResponseLike from 'responselike';
import getBodySize from './utils/get-body-size.js';
import isFormData from './utils/is-form-data.js';
Expand Down
27 changes: 11 additions & 16 deletions source/core/options.ts
@@ -1,28 +1,23 @@
import process from 'node:process';
import type {Buffer} from 'node:buffer';
import {promisify, inspect} from 'node:util';
import {checkServerIdentity} from 'node:tls';
import {promisify, inspect, type InspectOptions} from 'node:util';
import {checkServerIdentity, type SecureContextOptions, type DetailedPeerCertificate} from 'node:tls';
// DO NOT use destructuring for `https.request` and `http.request` as it's not compatible with `nock`.
import http from 'node:http';
import https from 'node:https';
import https, {
type RequestOptions as HttpsRequestOptions,
type Agent as HttpsAgent,
} from 'node:https';
import http, {
type Agent as HttpAgent,
type ClientRequest,
} from 'node:http';
import type {Readable} from 'node:stream';
import type {Socket} from 'node:net';
import type {SecureContextOptions, DetailedPeerCertificate} from 'node:tls';
import type {
Agent as HttpAgent,
ClientRequest,
} from 'node:http';
import type {
RequestOptions as HttpsRequestOptions,
Agent as HttpsAgent,
} from 'node:https';
import type {InspectOptions} from 'node:util';
import is, {assert} from '@sindresorhus/is';
import lowercaseKeys from 'lowercase-keys';
import CacheableLookup from 'cacheable-lookup';
import http2wrapper, {type ClientHttp2Session} from 'http2-wrapper';
import {isFormData} from 'form-data-encoder';
import type {FormDataLike} from 'form-data-encoder';
import {isFormData, type FormDataLike} from 'form-data-encoder';
import type {StorageAdapter} from 'cacheable-request';
import type ResponseLike from 'responselike';
import type {IncomingMessageWithTimings} from '@szmarczak/http-timer';
Expand Down
2 changes: 2 additions & 0 deletions source/index.ts
Expand Up @@ -11,6 +11,8 @@ const defaults: InstanceDefaults = {
const got = create(defaults);

export default got;

// TODO: Remove this in the next major version.
export {got};

export {default as Options} from './core/options.js';
Expand Down
4 changes: 2 additions & 2 deletions source/types.ts
@@ -1,8 +1,8 @@
import type {Buffer} from 'node:buffer';
import type {CancelableRequest} from './as-promise/types.js';
import type {Response} from './core/response.js';
import type Options from './core/options.js';
import type {PaginationOptions, OptionsInit} from './core/options.js';
import type Options from './core/options.js'; // eslint-disable-line import/no-duplicates
import {type PaginationOptions, type OptionsInit} from './core/options.js'; // eslint-disable-line import/no-duplicates -- It's not allowed to combine these imports. The rule is incorrect.
import type Request from './core/index.js';

// `type-fest` utilities
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Expand Up @@ -2,9 +2,9 @@
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
"outDir": "dist",
"target": "es2020", // Node.js 14
"target": "es2021", // Node.js 16
"lib": [
"es2020"
"es2021"
],
"noPropertyAccessFromIndexSignature": false,
"isolatedModules": true
Expand Down

0 comments on commit 944caa8

Please sign in to comment.