Skip to content

Commit

Permalink
chore: integrate automd
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 22, 2024
1 parent 80ed5b3 commit 5212f01
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 49 deletions.
1 change: 1 addition & 0 deletions .config/automd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
input: ["README.md", "docs/**/*.md"]
8 changes: 4 additions & 4 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"
- run: pnpm install
- name: Fix lint issues
run: pnpm run lint:fix
- run: pnpm run lint:fix
- run: pnpm automd
- uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84
with:
commit-message: "chore: apply automated fixes"
commit-message: "chore: apply automated updates"
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
# H3

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
<!-- automd:badges -->

[![npm version](https://flat.badgen.net/npm/v/h3)](https://npmjs.com/package/h3)
[![npm downloads](https://flat.badgen.net/npm/dm/h3)](https://npmjs.com/package/h3)

<!-- /automd -->

H3 (pronounced as /eɪtʃθriː/, like h-3) is a minimal h(ttp) framework built for high performance and portability.

👉 [Online Playground](https://stackblitz.com/github/unjs/h3/tree/main/playground)
👉 [Documentation](https://h3.unjs.io)

👉 [Online Examples Playground](https://stackblitz.com/github/unjs/h3/tree/main/examples)
## Contribution

## Features
<details>
<summary>Local development</summary>

✔️ &nbsp;**Portable:** Works perfectly in Serverless, Workers, and Node.js
- Clone this repository
- Install the latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run tests using `pnpm dev` or `pnpm test`

✔️ &nbsp;**Minimal:** Small and tree-shakable
</details>

✔️ &nbsp;**Modern:** Native promise support
<!-- /automd -->

✔️ &nbsp;**Extendable:** Ships with a set of composable utilities but can be extended
## License

✔️ &nbsp;**Router:** Super fast route matching using [unjs/radix3](https://github.com/unjs/radix3)
<!-- automd:contributors license=MIT author="pi0" -->

✔️ &nbsp;**Compatible:** Compatibility layer with node/connect/express middleware
Published under the [MIT](https://github.com/unjs/h3/blob/main/LICENSE) license.
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/h3/graphs/contributors) 💛
<br><br>
<a href="https://github.com/unjs/h3/graphs/contributors">
<img src="https://contrib.rocks/image?repo=unjs/h3" />
</a>

## License
<!-- /automd -->

<!-- automd:with-automd -->

---

_🤖 auto updated with [automd](https://automd.unjs.io)_

MIT

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/h3?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/h3
[npm-downloads-src]: https://img.shields.io/npm/dm/h3?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/h3
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/h3/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/h3
[bundle-src]: https://img.shields.io/bundlephobia/minzip/h3?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=h3
[license-src]: https://img.shields.io/github/license/unjs/h3.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/h3/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
[jsdocs-href]: https://www.jsdocs.io/package/h3
<!-- /automd -->
6 changes: 3 additions & 3 deletions docs/2.utils/1.request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Utilities to access incoming request
<!-- automd:jsdocs src="../src/utils/request.ts" -->
<!-- automd:jsdocs src="../../src/utils/request.ts" -->

### `assertMethod(event, expected, allowHead?)`

Expand Down Expand Up @@ -38,15 +38,15 @@

<!-- /automd -->

<!-- automd:jsdocs src="../src/utils/fingerprint.ts" -->
<!-- automd:jsdocs src="../../src/utils/fingerprint.ts" -->

### `getRequestFingerprint(event, opts)`

<!-- /automd -->

## Body utils

<!-- automd:jsdocs src="../src/utils/body.ts" -->
<!-- automd:jsdocs src="../../src/utils/body.ts" -->

### `getRequestWebStream(event)`

Expand Down
2 changes: 1 addition & 1 deletion docs/2.utils/2.reponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Utilities to send response headers and data
<!-- automd:jsdocs src="../src/utils/response.ts" -->
<!-- automd:jsdocs src="../../src/utils/response.ts" -->

### `appendHeader(event, name, value)`

Expand Down
16 changes: 8 additions & 8 deletions docs/2.utils/98.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Session utils

<!-- automd:jsdocs src="../src/utils/session.ts" -->
<!-- automd:jsdocs src="../../src/utils/session.ts" -->

### `clearSession(event, config)`

Expand All @@ -22,7 +22,7 @@

## Cookie utils

<!-- automd:jsdocs src="../src/utils/cookie.ts" -->
<!-- automd:jsdocs src="../../src/utils/cookie.ts" -->

### `deleteCookie(event, name, serializeOptions?)`

Expand All @@ -42,13 +42,13 @@ Set a cookie value by name.

### `splitCookiesString(cookiesString)`

Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas that are within a single set-cookie field-value, such as in the Expires portion. This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2 Node.js does this for every header _except_ set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128 Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25 Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas that are within a single set-cookie field-value, such as in the Expires portion. This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2 Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128 Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25 Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation

<!-- /automd -->

## Sanitize

<!-- automd:jsdocs src="../src/utils/sanitize.ts" -->
<!-- automd:jsdocs src="../../src/utils/sanitize.ts" -->

### `sanitizeStatusCode(statusCode?, defaultStatusCode)`

Expand All @@ -58,7 +58,7 @@ Set-Cookie header field-values are sometimes comma joined in one string. This sp

## Route

<!-- automd:jsdocs src="../src/utils/route.ts" -->
<!-- automd:jsdocs src="../../src/utils/route.ts" -->

### `useBase(base, handler)`

Expand All @@ -68,7 +68,7 @@ Prefixes and executes a handler with a base path.

## Cache

<!-- automd:jsdocs src="../src/utils/cache.ts" -->
<!-- automd:jsdocs src="../../src/utils/cache.ts" -->

### `handleCacheHeaders(event, opts)`

Expand All @@ -78,7 +78,7 @@ Check request caching headers (`If-Modified-Since`) and add caching headers (Las

## Proxy

<!-- automd:jsdocs src="../src/utils/proxy.ts" -->
<!-- automd:jsdocs src="../../src/utils/proxy.ts" -->

### `fetchWithEvent(event, req, init?, options?: { fetch: F })`

Expand All @@ -92,7 +92,7 @@ Check request caching headers (`If-Modified-Since`) and add caching headers (Las

## CORS

<!-- automd:jsdocs src="../src/utils/cors/index.ts" -->
<!-- automd:jsdocs src="../../src/utils/cors/index.ts" -->

### `appendCorsHeaders(event, options)`

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.3.1",
"autocannon": "^7.15.0",
"automd": "^0.3.5",
"changelogen": "^0.5.5",
"connect": "^3.7.0",
"eslint": "^8.56.0",
Expand Down
Loading

0 comments on commit 5212f01

Please sign in to comment.