milliparsec 2.3.0 → 3.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.
package/README.md CHANGED
@@ -17,9 +17,10 @@ Check out [deno-libs/parsec](https://github.com/deno-libs/parsec) for Deno port.
17
17
 
18
18
  - ⏩ built with `async` / `await`
19
19
  - 🛠 JSON / raw / urlencoded data support
20
- - 📦 tiny package size (728B)
20
+ - 📦 tiny package size (675B)
21
21
  - 🔥 no dependencies
22
- - [tinyhttp](https://github.com/talentlessguy/tinyhttp) and Express support
22
+ - [tinyhttp](https://github.com/tinyhttp/tinyhttp) and Express support
23
+ - ⚡ 30% faster than body-parser
23
24
 
24
25
  ## Install
25
26
 
@@ -108,6 +109,6 @@ The parsec is a unit of length used to measure large distances to astronomical o
108
109
  [npm-url]: https://www.npmjs.com/package/milliparsec
109
110
  [dl-badge-url]: https://img.shields.io/npm/dt/milliparsec?style=for-the-badge&color=25608B
110
111
  [github-actions]: https://github.com/talentlessguy/milliparsec/actions
111
- [gh-actions-img]: https://img.shields.io/github/workflow/status/talentlessguy/milliparsec/CI?style=for-the-badge&color=25608B&label=&logo=github
112
+ [gh-actions-img]: https://img.shields.io/github/actions/workflow/status/tinyhttp/milliparsec/main.yml?branch=master&style=for-the-badge&color=25608B&label=&logo=github
112
113
  [cov-img]: https://img.shields.io/coveralls/github/tinyhttp/milliparsec?style=for-the-badge&color=25608B
113
114
  [cov-url]: https://coveralls.io/github/tinyhttp/milliparsec
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { ServerResponse as Response, IncomingMessage } from 'http';
4
- import { EventEmitter } from 'events';
1
+ import type { EventEmitter } from 'node:events';
2
+ import type { IncomingMessage, ServerResponse as Response } from 'node:http';
5
3
  type NextFunction = (err?: any) => void;
6
4
  export type ReqWithBody<T = any> = IncomingMessage & {
7
5
  body?: T;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- const hasBody = (method) => ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
1
+ export const hasBody = (method) => ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
2
2
  // Main function
3
- const p = (fn) => async (req, _res, next) => {
3
+ export const p = (fn) => async (req, _res, next) => {
4
4
  try {
5
5
  let body = '';
6
6
  for await (const chunk of req)
@@ -51,5 +51,4 @@ const urlencoded = () => async (req, res, next) => {
51
51
  else
52
52
  next();
53
53
  };
54
-
55
- export { custom, hasBody, json, p, raw, text, urlencoded };
54
+ export { custom, json, raw, text, urlencoded };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "milliparsec",
3
- "version": "2.3.0",
3
+ "version": "3.0.0",
4
4
  "description": "tiniest body parser in the universe",
5
5
  "repository": "https://github.com/talentlessguy/parsec.git",
6
6
  "author": "talentlessguy <pilll.PL22@gmail.com>",
@@ -14,19 +14,17 @@
14
14
  "body-parsing"
15
15
  ],
16
16
  "engines": {
17
- "node": ">=12.4"
17
+ "node": ">=12.20"
18
18
  },
19
19
  "exports": "./dist/index.js",
20
20
  "devDependencies": {
21
- "@rollup/plugin-typescript": "^11.1.0",
22
- "@tinyhttp/app": "^2.0.31",
23
- "@types/node": "^18.16.3",
24
- "c8": "7.13.0",
25
- "rollup": "^3.21.4",
26
- "supertest-fetch": "^1.5.0",
27
- "tslib": "^2.5.0",
21
+ "@biomejs/biome": "1.8.3",
22
+ "@tinyhttp/app": "^2.2.4",
23
+ "@types/node": "^20.14.9",
24
+ "c8": "10.1.2",
25
+ "supertest-fetch": "^2.0.0",
28
26
  "tsm": "^2.3.0",
29
- "typescript": "^5.0.4",
27
+ "typescript": "^5.5.3",
30
28
  "uvu": "^0.5.6"
31
29
  },
32
30
  "files": [
@@ -36,6 +34,6 @@
36
34
  "test": "uvu -r tsm",
37
35
  "test:coverage": "c8 --include=src pnpm test",
38
36
  "test:report": "c8 report --reporter=text-lcov > coverage.lcov",
39
- "build": "rollup -c"
37
+ "build": "tsc -p tsconfig.build.json"
40
38
  }
41
39
  }