Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 25, 2024
1 parent 8764419 commit db4247b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 18 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ky",
"version": "1.4.0",
"description": "Tiny and elegant HTTP client based on the browser Fetch API",
"description": "Tiny and elegant HTTP client based on the Fetch API",
"license": "MIT",
"repository": "sindresorhus/ky",
"funding": "https://github.com/sindresorhus/ky?sponsor=1",
Expand Down Expand Up @@ -54,25 +54,25 @@
"node-fetch"
],
"devDependencies": {
"@sindresorhus/tsconfig": "^4.0.0",
"@sindresorhus/tsconfig": "^6.0.0",
"@type-challenges/utils": "^0.1.1",
"@types/body-parser": "^1.19.2",
"@types/busboy": "^1.5.0",
"@types/express": "^4.17.17",
"@types/node": "^20.5.7",
"@types/node": "^20.14.12",
"ava": "^5.3.1",
"body-parser": "^1.20.2",
"busboy": "^1.6.0",
"del-cli": "^5.1.0",
"delay": "^6.0.0",
"expect-type": "^0.16.0",
"expect-type": "^0.19.0",
"express": "^4.18.2",
"pify": "^6.1.0",
"playwright": "^1.40.1",
"playwright": "^1.45.3",
"raw-body": "^2.5.2",
"tsx": "^4.7.0",
"typescript": "^5.2.2",
"xo": "^0.56.0"
"tsx": "^4.16.2",
"typescript": "^5.5.4",
"xo": "^0.58.0"
},
"xo": {
"envs": [
Expand All @@ -85,7 +85,8 @@
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/naming-convention": "off"
"@typescript-eslint/naming-convention": "off",
"n/no-unsupported-features/node-builtins": "off"
}
},
"ava": {
Expand Down
7 changes: 4 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
<br>
</div>

> Ky is a tiny and elegant HTTP client based on the browser [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)
> Ky is a tiny and elegant HTTP client based on the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)
[![Coverage Status](https://codecov.io/gh/sindresorhus/ky/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/ky)
[![](https://badgen.net/bundlephobia/minzip/ky)](https://bundlephobia.com/result?p=ky)

Ky targets [modern browsers](#browser-support), Node.js, and Deno.
Ky targets [modern browsers](#browser-support), Node.js, Bun, and Deno.

It's just a tiny package with no dependencies.

Expand Down Expand Up @@ -705,7 +705,7 @@ import ky from 'https://unpkg.com/ky/distribution/index.js';
const json = await ky('https://jsonplaceholder.typicode.com/todos/1').json();
console.log(json.title);
//=> 'delectus aut autem
//=> 'delectus aut autem'
</script>
```

Expand Down Expand Up @@ -737,6 +737,7 @@ Node.js 18 and later.

## Related

- [fetch-extras](https://github.com/sindresorhus/fetch-extras) - Useful utilities for working with Fetch
- [got](https://github.com/sindresorhus/got) - Simplified HTTP requests for Node.js
- [ky-hooks-change-case](https://github.com/alice-health/ky-hooks-change-case) - Ky hooks to modify cases on requests and responses of objects

Expand Down
8 changes: 7 additions & 1 deletion source/core/Ky.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import {HTTPError} from '../errors/HTTPError.js';
import {TimeoutError} from '../errors/TimeoutError.js';
import type {Hooks} from '../types/hooks.js';
import type {Input, InternalOptions, NormalizedOptions, Options, SearchParamsInit} from '../types/options.js';
import type {
Input,
InternalOptions,
NormalizedOptions,
Options,
SearchParamsInit,
} from '../types/options.js';
import {type ResponsePromise} from '../types/ResponsePromise.js';
import {deepMerge, mergeHeaders} from '../utils/merge.js';
import {normalizeRequestMethod, normalizeRetryOptions} from '../utils/normalize.js';
Expand Down
2 changes: 1 addition & 1 deletion source/types/ky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export type KyInstance = {
You can also refer to parent defaults by providing a function to `.extend()`.
@example
```js
```
import ky from 'ky';
const api = ky.create({prefixUrl: 'https://example.com/api'});
Expand Down
2 changes: 1 addition & 1 deletion source/utils/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function delay(

function abortHandler() {
clearTimeout(timeoutId);
reject(signal!.reason);
reject(signal!.reason as Error);
}

const timeoutId = setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions test/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import test, {type ExecutionContext} from 'ava';
import busboy from 'busboy';
import express from 'express';
import {chromium, webkit, type Page} from 'playwright';
import type ky from '../source/index.js';
import type {DownloadProgress} from '../source/index.js';
import type ky from '../source/index.js'; // eslint-disable-line import/no-duplicates
import type {DownloadProgress} from '../source/index.js'; // eslint-disable-line import/no-duplicates
import {createHttpTestServer, type ExtendedHttpTestServer, type HttpServerOptions} from './helpers/create-http-test-server.js';
import {parseRawBody} from './helpers/parse-body.js';
import {browserTest, defaultBrowsersTest} from './helpers/with-page.js';
Expand Down
8 changes: 7 additions & 1 deletion test/helpers/with-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import process from 'node:process';
import test, {type ExecutionContext} from 'ava';
import {chromium, firefox, webkit, type BrowserType, type Page} from 'playwright';
import {
chromium,
firefox,
webkit,
type BrowserType,
type Page,
} from 'playwright';

type Run = (t: ExecutionContext, page: Page) => Promise<void>;

Expand Down
2 changes: 2 additions & 0 deletions test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,10 @@ test('options override Request instance body', async t => {
});

server.post('/', (request, response) => {
// eslint-disable-next-line @typescript-eslint/ban-types
const body: Buffer[] = [];

// eslint-disable-next-line @typescript-eslint/ban-types
request.on('data', (chunk: Buffer) => {
body.push(chunk);
});
Expand Down

0 comments on commit db4247b

Please sign in to comment.