got 14.6.5 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/source/as-promise/index.d.ts +2 -2
  2. package/dist/source/as-promise/index.js +59 -41
  3. package/dist/source/as-promise/types.d.ts +10 -23
  4. package/dist/source/as-promise/types.js +1 -17
  5. package/dist/source/core/calculate-retry-delay.js +1 -4
  6. package/dist/source/core/diagnostics-channel.js +12 -21
  7. package/dist/source/core/errors.d.ts +2 -1
  8. package/dist/source/core/errors.js +7 -10
  9. package/dist/source/core/index.d.ts +19 -7
  10. package/dist/source/core/index.js +726 -311
  11. package/dist/source/core/options.d.ts +92 -91
  12. package/dist/source/core/options.js +616 -303
  13. package/dist/source/core/response.d.ts +5 -3
  14. package/dist/source/core/response.js +26 -3
  15. package/dist/source/core/timed-out.d.ts +1 -1
  16. package/dist/source/core/timed-out.js +3 -3
  17. package/dist/source/core/utils/defer-to-connect.js +5 -17
  18. package/dist/source/core/utils/get-body-size.d.ts +1 -1
  19. package/dist/source/core/utils/get-body-size.js +3 -20
  20. package/dist/source/core/utils/proxy-events.d.ts +1 -1
  21. package/dist/source/core/utils/proxy-events.js +3 -3
  22. package/dist/source/core/utils/strip-url-auth.d.ts +1 -0
  23. package/dist/source/core/utils/strip-url-auth.js +9 -0
  24. package/dist/source/core/utils/timer.js +5 -7
  25. package/dist/source/core/utils/unhandle.js +1 -2
  26. package/dist/source/create.js +83 -27
  27. package/dist/source/index.d.ts +2 -3
  28. package/dist/source/index.js +0 -4
  29. package/dist/source/types.d.ts +42 -70
  30. package/package.json +34 -38
  31. package/readme.md +2 -2
  32. package/dist/source/core/utils/is-form-data.d.ts +0 -7
  33. package/dist/source/core/utils/is-form-data.js +0 -4
  34. package/dist/source/core/utils/url-to-options.d.ts +0 -14
  35. package/dist/source/core/utils/url-to-options.js +0 -22
@@ -1,8 +1,9 @@
1
- import type { Buffer } from 'node:buffer';
2
1
  import type { IncomingMessageWithTimings, Timings } from './utils/timer.js';
3
2
  import { RequestError } from './errors.js';
4
3
  import type { ParseJsonFunction, ResponseType } from './options.js';
5
4
  import type Request from './index.js';
5
+ export declare const isUtf8Encoding: (encoding?: BufferEncoding) => boolean;
6
+ export declare const decodeUint8Array: (data: Uint8Array, encoding?: BufferEncoding) => string;
6
7
  export type PlainResponse = {
7
8
  /**
8
9
  The original request URL.
@@ -73,7 +74,7 @@ export type PlainResponse = {
73
74
  /**
74
75
  The raw result of the request.
75
76
  */
76
- rawBody?: Buffer;
77
+ rawBody?: Uint8Array<ArrayBuffer>;
77
78
  /**
78
79
  The result of the request.
79
80
  */
@@ -93,7 +94,7 @@ export type Response<T = unknown> = {
93
94
  /**
94
95
  The raw result of the request.
95
96
  */
96
- rawBody: Buffer;
97
+ rawBody: Uint8Array<ArrayBuffer>;
97
98
  } & PlainResponse;
98
99
  export declare const isResponseOk: (response: PlainResponse) => boolean;
99
100
  /**
@@ -106,4 +107,5 @@ export declare class ParseError extends RequestError {
106
107
  readonly response: Response;
107
108
  constructor(error: Error, response: Response);
108
109
  }
110
+ export declare const cacheDecodedBody: (response: PlainResponse, decodedBody: string) => void;
109
111
  export declare const parseBody: (response: Response, responseType: ResponseType, parseJson: ParseJsonFunction, encoding?: BufferEncoding) => unknown;
@@ -1,4 +1,16 @@
1
+ import { Buffer } from 'node:buffer';
1
2
  import { RequestError } from './errors.js';
3
+ import stripUrlAuth from './utils/strip-url-auth.js';
4
+ const decodedBodyCache = new WeakMap();
5
+ // Intentionally uses TextDecoder so the UTF-8 path strips a leading BOM.
6
+ const textDecoder = new TextDecoder();
7
+ export const isUtf8Encoding = (encoding) => encoding === undefined || encoding.toLowerCase().replace('-', '') === 'utf8';
8
+ export const decodeUint8Array = (data, encoding) => {
9
+ if (isUtf8Encoding(encoding)) {
10
+ return textDecoder.decode(data);
11
+ }
12
+ return Buffer.from(data).toString(encoding);
13
+ };
2
14
  export const isResponseOk = (response) => {
3
15
  const { statusCode } = response;
4
16
  const { followRedirect } = response.request.options;
@@ -15,17 +27,28 @@ export class ParseError extends RequestError {
15
27
  code = 'ERR_BODY_PARSE_FAILURE';
16
28
  constructor(error, response) {
17
29
  const { options } = response.request;
18
- super(`${error.message} in "${options.url.toString()}"`, error, response.request);
30
+ super(`${error.message} in "${stripUrlAuth(options.url)}"`, error, response.request);
19
31
  }
20
32
  }
33
+ export const cacheDecodedBody = (response, decodedBody) => {
34
+ decodedBodyCache.set(response, decodedBody);
35
+ };
21
36
  export const parseBody = (response, responseType, parseJson, encoding) => {
22
37
  const { rawBody } = response;
38
+ const cachedDecodedBody = decodedBodyCache.get(response);
23
39
  try {
24
40
  if (responseType === 'text') {
25
- return rawBody.toString(encoding);
41
+ if (cachedDecodedBody !== undefined) {
42
+ return cachedDecodedBody;
43
+ }
44
+ return decodeUint8Array(rawBody, encoding);
26
45
  }
27
46
  if (responseType === 'json') {
28
- return rawBody.length === 0 ? '' : parseJson(rawBody.toString(encoding));
47
+ if (rawBody.length === 0) {
48
+ return '';
49
+ }
50
+ const text = cachedDecodedBody ?? decodeUint8Array(rawBody, encoding);
51
+ return parseJson(text);
29
52
  }
30
53
  if (responseType === 'buffer') {
31
54
  return rawBody;
@@ -17,9 +17,9 @@ export type Delays = {
17
17
  };
18
18
  export type ErrorCode = 'ETIMEDOUT' | 'ECONNRESET' | 'EADDRINUSE' | 'ECONNREFUSED' | 'EPIPE' | 'ENOTFOUND' | 'ENETUNREACH' | 'EAI_AGAIN';
19
19
  export declare class TimeoutError extends Error {
20
- event: string;
21
20
  name: string;
22
21
  code: ErrorCode;
22
+ event: string;
23
23
  constructor(threshold: number, event: string);
24
24
  }
25
25
  export default function timedOut(request: ClientRequest, delays: Delays, options: TimedOutOptions): () => void;
@@ -3,9 +3,9 @@ import unhandler from './utils/unhandle.js';
3
3
  const reentry = Symbol('reentry');
4
4
  const noop = () => { };
5
5
  export class TimeoutError extends Error {
6
- event;
7
6
  name = 'TimeoutError';
8
7
  code = 'ETIMEDOUT';
8
+ event;
9
9
  constructor(threshold, event) {
10
10
  super(`Timeout awaiting '${event}' for ${threshold}ms`);
11
11
  this.event = event;
@@ -18,12 +18,12 @@ export default function timedOut(request, delays, options) {
18
18
  request[reentry] = true;
19
19
  const cancelers = [];
20
20
  const { once, unhandleAll } = unhandler();
21
- const handled = new Map();
21
+ const handled = new Set();
22
22
  const addTimeout = (delay, callback, event) => {
23
23
  const timeout = setTimeout(callback, delay, delay, event);
24
24
  timeout.unref?.();
25
25
  const cancel = () => {
26
- handled.set(event, true);
26
+ handled.add(event);
27
27
  clearTimeout(timeout);
28
28
  };
29
29
  cancelers.push(cancel);
@@ -2,22 +2,10 @@ function isTlsSocket(socket) {
2
2
  return 'encrypted' in socket;
3
3
  }
4
4
  const deferToConnect = (socket, fn) => {
5
- let listeners;
6
- if (typeof fn === 'function') {
7
- const connect = fn;
8
- listeners = { connect };
9
- }
10
- else {
11
- listeners = fn;
12
- }
13
- const hasConnectListener = typeof listeners.connect === 'function';
14
- const hasSecureConnectListener = typeof listeners.secureConnect === 'function';
15
- const hasCloseListener = typeof listeners.close === 'function';
5
+ const listeners = typeof fn === 'function' ? { connect: fn } : fn;
16
6
  const onConnect = () => {
17
- if (hasConnectListener) {
18
- listeners.connect();
19
- }
20
- if (isTlsSocket(socket) && hasSecureConnectListener) {
7
+ listeners.connect?.();
8
+ if (isTlsSocket(socket) && listeners.secureConnect) {
21
9
  if (socket.authorized) {
22
10
  listeners.secureConnect();
23
11
  }
@@ -26,7 +14,7 @@ const deferToConnect = (socket, fn) => {
26
14
  socket.once('secureConnect', listeners.secureConnect);
27
15
  }
28
16
  }
29
- if (hasCloseListener) {
17
+ if (listeners.close) {
30
18
  socket.once('close', listeners.close);
31
19
  }
32
20
  };
@@ -36,7 +24,7 @@ const deferToConnect = (socket, fn) => {
36
24
  else if (socket.connecting) {
37
25
  socket.once('connect', onConnect);
38
26
  }
39
- else if (socket.destroyed && hasCloseListener) {
27
+ else if (socket.destroyed && listeners.close) {
40
28
  const hadError = '_hadError' in socket ? Boolean(socket._hadError) : false;
41
29
  listeners.close(hadError);
42
30
  }
@@ -1,2 +1,2 @@
1
1
  import type { ClientRequestArgs } from 'node:http';
2
- export default function getBodySize(body: unknown, headers: ClientRequestArgs['headers']): Promise<number | undefined>;
2
+ export default function getBodySize(body: unknown, headers: ClientRequestArgs['headers']): number | undefined;
@@ -1,7 +1,6 @@
1
- import { promisify } from 'node:util';
2
1
  import is from '@sindresorhus/is';
3
- import isFormData from './is-form-data.js';
4
- export default async function getBodySize(body, headers) {
2
+ import { stringToUint8Array } from 'uint8array-extras';
3
+ export default function getBodySize(body, headers) {
5
4
  if (headers && 'content-length' in headers) {
6
5
  return Number(headers['content-length']);
7
6
  }
@@ -9,7 +8,7 @@ export default async function getBodySize(body, headers) {
9
8
  return 0;
10
9
  }
11
10
  if (is.string(body)) {
12
- return new TextEncoder().encode(body).byteLength;
11
+ return stringToUint8Array(body).byteLength;
13
12
  }
14
13
  if (is.buffer(body)) {
15
14
  return body.length;
@@ -17,21 +16,5 @@ export default async function getBodySize(body, headers) {
17
16
  if (is.typedArray(body)) {
18
17
  return body.byteLength;
19
18
  }
20
- if (isFormData(body)) {
21
- try {
22
- return await promisify(body.getLength.bind(body))();
23
- }
24
- catch (error) {
25
- const typedError = error;
26
- throw new Error('Cannot determine content-length for form-data with stream(s) of unknown length. '
27
- + 'This is a limitation of the `form-data` package. '
28
- + 'To fix this, either:\n'
29
- + '1. Use the `knownLength` option when appending streams:\n'
30
- + ' form.append(\'file\', stream, {knownLength: 12345});\n'
31
- + '2. Switch to spec-compliant FormData (formdata-node package)\n'
32
- + 'See: https://github.com/form-data/form-data#alternative-submission-methods\n'
33
- + `Original error: ${typedError.message}`);
34
- }
35
- }
36
19
  return undefined;
37
20
  }
@@ -1,2 +1,2 @@
1
1
  import type { EventEmitter } from 'node:events';
2
- export default function proxyEvents(from: EventEmitter, to: EventEmitter, events: Readonly<string[]>): () => void;
2
+ export default function proxyEvents(from: EventEmitter, to: EventEmitter, events: readonly string[]): () => void;
@@ -1,14 +1,14 @@
1
1
  export default function proxyEvents(from, to, events) {
2
- const eventFunctions = {};
2
+ const eventFunctions = new Map();
3
3
  for (const event of events) {
4
4
  const eventFunction = (...arguments_) => {
5
5
  to.emit(event, ...arguments_);
6
6
  };
7
- eventFunctions[event] = eventFunction;
7
+ eventFunctions.set(event, eventFunction);
8
8
  from.on(event, eventFunction);
9
9
  }
10
10
  return () => {
11
- for (const [event, eventFunction] of Object.entries(eventFunctions)) {
11
+ for (const [event, eventFunction] of eventFunctions) {
12
12
  from.off(event, eventFunction);
13
13
  }
14
14
  };
@@ -0,0 +1 @@
1
+ export default function stripUrlAuth(url: URL | string): string;
@@ -0,0 +1,9 @@
1
+ /*
2
+ Returns the URL as a string with `username` and `password` stripped.
3
+ */
4
+ export default function stripUrlAuth(url) {
5
+ const sanitized = new URL(url);
6
+ sanitized.username = '';
7
+ sanitized.password = '';
8
+ return sanitized.toString();
9
+ }
@@ -100,13 +100,11 @@ const timer = (request) => {
100
100
  timings.phases.dns = 0;
101
101
  }
102
102
  // Store connection phase timings on socket for potential reuse
103
- if (!socket.__initial_connection_timings__) {
104
- socket.__initial_connection_timings__ = {
105
- dnsPhase: timings.phases.dns,
106
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- TypeScript can't prove this is defined due to callback structure
107
- tcpPhase: timings.phases.tcp,
108
- };
109
- }
103
+ socket.__initial_connection_timings__ ??= {
104
+ dnsPhase: timings.phases.dns,
105
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- TypeScript can't prove this is defined due to callback structure
106
+ tcpPhase: timings.phases.tcp,
107
+ };
110
108
  },
111
109
  secureConnect() {
112
110
  timings.secureConnect = Date.now();
@@ -10,8 +10,7 @@ export default function unhandle() {
10
10
  handlers.push({ origin, event, fn: function_ });
11
11
  },
12
12
  unhandleAll() {
13
- for (const handler of handlers) {
14
- const { origin, event, fn } = handler;
13
+ for (const { origin, event, fn } of handlers) {
15
14
  origin.removeListener(event, fn);
16
15
  }
17
16
  handlers.length = 0;
@@ -2,7 +2,7 @@ import { setTimeout as delay } from 'node:timers/promises';
2
2
  import is, { assert } from '@sindresorhus/is';
3
3
  import asPromise from './as-promise/index.js';
4
4
  import Request from './core/index.js';
5
- import Options from './core/options.js';
5
+ import Options, { applyUrlOverride, isSameOrigin, snapshotCrossOriginState, } from './core/options.js';
6
6
  const isGotInstance = (value) => is.function(value);
7
7
  const aliases = [
8
8
  'get',
@@ -12,6 +12,22 @@ const aliases = [
12
12
  'head',
13
13
  'delete',
14
14
  ];
15
+ const optionsObjectUrlErrorMessage = 'The `url` option is not supported in options objects. Pass it as the first argument instead.';
16
+ const assertNoUrlInOptionsObject = (options) => {
17
+ if (Object.hasOwn(options, 'url')) {
18
+ throw new TypeError(optionsObjectUrlErrorMessage);
19
+ }
20
+ };
21
+ const cloneWithProperty = (value, property, propertyValue) => {
22
+ const clone = Object.create(Object.getPrototypeOf(value), Object.getOwnPropertyDescriptors(value));
23
+ Object.defineProperty(clone, property, {
24
+ value: propertyValue,
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ });
29
+ return clone;
30
+ };
15
31
  const create = (defaults) => {
16
32
  defaults = {
17
33
  options: new Options(undefined, undefined, defaults.options),
@@ -23,19 +39,32 @@ const create = (defaults) => {
23
39
  configurable: false,
24
40
  writable: false,
25
41
  });
26
- // Got interface
27
- const got = ((url, options, defaultOptions = defaults.options) => {
28
- const request = new Request(url, options, defaultOptions);
42
+ const makeRequest = (url, options, defaultOptions, isStream) => {
43
+ if (is.plainObject(url)) {
44
+ assertNoUrlInOptionsObject(url);
45
+ }
46
+ if (is.plainObject(options)) {
47
+ assertNoUrlInOptionsObject(options);
48
+ }
49
+ // `isStream` is skipped by `merge()`, so set it via the direct setter after construction.
50
+ // Avoid a synthetic second merge only for the single-options-object stream form.
51
+ const requestUrl = isStream && is.plainObject(url) ? cloneWithProperty(url, 'isStream', true) : url;
52
+ const requestOptions = isStream && !is.plainObject(url) && options ? cloneWithProperty(options, 'isStream', true) : options;
53
+ const request = new Request(requestUrl, requestOptions, defaultOptions);
54
+ if (isStream && request.options) {
55
+ request.options.isStream = true;
56
+ }
29
57
  let promise;
30
58
  const lastHandler = (normalized) => {
31
59
  // Note: `options` is `undefined` when `new Options(...)` fails
32
60
  request.options = normalized;
33
- request._noPipe = !normalized?.isStream;
61
+ const shouldReturnStream = normalized?.isStream ?? isStream;
62
+ request._noPipe = !shouldReturnStream;
34
63
  void request.flush();
35
- if (normalized?.isStream) {
64
+ if (shouldReturnStream) {
36
65
  return request;
37
66
  }
38
- promise ||= asPromise(request);
67
+ promise ??= asPromise(request);
39
68
  return promise;
40
69
  };
41
70
  let iteration = 0;
@@ -43,7 +72,7 @@ const create = (defaults) => {
43
72
  const handler = defaults.handlers[iteration++] ?? lastHandler;
44
73
  const result = handler(newOptions, iterateHandlers);
45
74
  if (is.promise(result) && !request.options?.isStream) {
46
- promise ||= asPromise(request);
75
+ promise ??= asPromise(request);
47
76
  if (result !== promise) {
48
77
  const descriptors = Object.getOwnPropertyDescriptors(promise);
49
78
  for (const key in descriptors) {
@@ -54,13 +83,14 @@ const create = (defaults) => {
54
83
  }
55
84
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
56
85
  Object.defineProperties(result, descriptors);
57
- result.cancel = promise.cancel;
58
86
  }
59
87
  }
60
88
  return result;
61
89
  };
62
90
  return iterateHandlers(request.options);
63
- });
91
+ };
92
+ // Got interface
93
+ const got = ((url, options, defaultOptions = defaults.options) => makeRequest(url, options, defaultOptions, false));
64
94
  got.extend = (...instancesOrOptions) => {
65
95
  const options = new Options(undefined, undefined, defaults.options);
66
96
  const handlers = [...defaults.handlers];
@@ -72,6 +102,7 @@ const create = (defaults) => {
72
102
  mutableDefaults = value.defaults.mutableDefaults;
73
103
  }
74
104
  else {
105
+ assertNoUrlInOptionsObject(value);
75
106
  options.merge(value);
76
107
  if (value.handlers) {
77
108
  handlers.push(...value.handlers);
@@ -87,6 +118,12 @@ const create = (defaults) => {
87
118
  };
88
119
  // Pagination
89
120
  const paginateEach = (async function* (url, options) {
121
+ if (is.plainObject(url)) {
122
+ assertNoUrlInOptionsObject(url);
123
+ }
124
+ if (is.plainObject(options)) {
125
+ assertNoUrlInOptionsObject(options);
126
+ }
90
127
  let normalizedOptions = new Options(url, options, defaults.options);
91
128
  normalizedOptions.resolveBodyOnly = false;
92
129
  const { pagination } = normalizedOptions;
@@ -126,21 +163,41 @@ const create = (defaults) => {
126
163
  }
127
164
  }
128
165
  }
129
- const optionsToMerge = pagination.paginate({
130
- response,
131
- currentItems,
132
- allItems,
133
- });
166
+ const requestOptions = response.request.options;
167
+ const previousUrl = requestOptions.url ? new URL(requestOptions.url) : undefined;
168
+ const previousState = previousUrl ? snapshotCrossOriginState(requestOptions) : undefined;
169
+ // eslint-disable-next-line no-await-in-loop
170
+ const [optionsToMerge, changedState] = await requestOptions.trackStateMutations(async (changedState) => [
171
+ pagination.paginate({
172
+ response,
173
+ currentItems,
174
+ allItems,
175
+ }),
176
+ changedState,
177
+ ]);
134
178
  if (optionsToMerge === false) {
135
179
  return;
136
180
  }
137
181
  if (optionsToMerge === response.request.options) {
138
182
  normalizedOptions = response.request.options;
183
+ if (previousUrl) {
184
+ const nextUrl = normalizedOptions.url;
185
+ if (nextUrl && !isSameOrigin(previousUrl, nextUrl)) {
186
+ normalizedOptions.prefixUrl = '';
187
+ normalizedOptions.stripUnchangedCrossOriginState(previousState, changedState);
188
+ }
189
+ }
139
190
  }
140
191
  else {
192
+ const hasExplicitBody = (Object.hasOwn(optionsToMerge, 'body') && optionsToMerge.body !== undefined)
193
+ || (Object.hasOwn(optionsToMerge, 'json') && optionsToMerge.json !== undefined)
194
+ || (Object.hasOwn(optionsToMerge, 'form') && optionsToMerge.form !== undefined);
195
+ if (hasExplicitBody) {
196
+ normalizedOptions.clearBody();
197
+ }
141
198
  normalizedOptions.merge(optionsToMerge);
142
199
  try {
143
- assert.any([is.urlInstance, is.undefined], optionsToMerge.url);
200
+ assert.any([is.string, is.urlInstance, is.undefined], optionsToMerge.url);
144
201
  }
145
202
  catch (error) {
146
203
  if (error instanceof Error) {
@@ -149,29 +206,28 @@ const create = (defaults) => {
149
206
  throw error;
150
207
  }
151
208
  if (optionsToMerge.url !== undefined) {
152
- normalizedOptions.prefixUrl = '';
153
- normalizedOptions.url = optionsToMerge.url;
209
+ const nextUrl = applyUrlOverride(normalizedOptions, optionsToMerge.url, optionsToMerge);
210
+ if (previousUrl) {
211
+ normalizedOptions.stripSensitiveHeaders(previousUrl, nextUrl, optionsToMerge);
212
+ if (!isSameOrigin(previousUrl, nextUrl) && !hasExplicitBody) {
213
+ normalizedOptions.clearBody();
214
+ }
215
+ }
154
216
  }
155
217
  }
156
218
  numberOfRequests++;
157
219
  }
158
220
  });
159
221
  got.paginate = paginateEach;
160
- got.paginate.all = (async (url, options) => {
161
- const results = [];
162
- for await (const item of paginateEach(url, options)) {
163
- results.push(item);
164
- }
165
- return results;
166
- });
222
+ got.paginate.all = (async (url, options) => Array.fromAsync(paginateEach(url, options)));
167
223
  // For those who like very descriptive names
168
224
  got.paginate.each = paginateEach;
169
225
  // Stream API
170
- got.stream = ((url, options) => got(url, { ...options, isStream: true }));
226
+ got.stream = ((url, options) => makeRequest(url, options, defaults.options, true));
171
227
  // Shortcuts
172
228
  for (const method of aliases) {
173
229
  got[method] = ((url, options) => got(url, { ...options, method }));
174
- got.stream[method] = ((url, options) => got(url, { ...options, method, isStream: true }));
230
+ got.stream[method] = ((url, options) => makeRequest(url, { ...options, method }, defaults.options, true));
175
231
  }
176
232
  if (!defaults.mutableDefaults) {
177
233
  Object.freeze(defaults.handlers);
@@ -1,6 +1,5 @@
1
1
  declare const got: import("./types.js").Got;
2
2
  export default got;
3
- export { got };
4
3
  export { default as Options } from './core/options.js';
5
4
  export * from './core/options.js';
6
5
  export * from './core/response.js';
@@ -10,7 +9,7 @@ export * from './core/errors.js';
10
9
  export * from './core/diagnostics-channel.js';
11
10
  export type { Delays } from './core/timed-out.js';
12
11
  export { default as calculateRetryDelay } from './core/calculate-retry-delay.js';
13
- export * from './as-promise/types.js';
14
- export * from './types.js';
12
+ export type * from './as-promise/types.js';
13
+ export type * from './types.js';
15
14
  export { default as create } from './create.js';
16
15
  export { default as parseLinkHeader } from './core/parse-link-header.js';
@@ -7,8 +7,6 @@ const defaults = {
7
7
  };
8
8
  const got = create(defaults);
9
9
  export default got;
10
- // TODO: Remove this in the next major version.
11
- export { got };
12
10
  export { default as Options } from './core/options.js';
13
11
  export * from './core/options.js';
14
12
  export * from './core/response.js';
@@ -16,7 +14,5 @@ export * from './core/index.js';
16
14
  export * from './core/errors.js';
17
15
  export * from './core/diagnostics-channel.js';
18
16
  export { default as calculateRetryDelay } from './core/calculate-retry-delay.js';
19
- export * from './as-promise/types.js';
20
- export * from './types.js';
21
17
  export { default as create } from './create.js';
22
18
  export { default as parseLinkHeader } from './core/parse-link-header.js';