Skip to content

Commit 8b4743c

Browse files
authored
fix: invalid deps
1 parent 962c6ab commit 8b4743c

File tree

10 files changed

+37
-23
lines changed

10 files changed

+37
-23
lines changed

.changeset/long-feet-train.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@tinyhttp/router": patch
3+
"@tinyhttp/app": patch
4+
"@tinyhttp/req": patch
5+
"@tinyhttp/res": patch
6+
---
7+
8+
Fix invalid (duplicate and uneeded) dependencies

CLAUDE.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
tinyhttp is a modern Express-like web framework written in TypeScript, compiled to native ESM with minimal dependencies. It provides Express middleware compatibility while targeting recent Node.js versions without legacy polyfills.
88

9+
**Documentation**: https://tinyhttp.v1rtl.site
10+
911
## Project Structure
1012

1113
This is a **pnpm monorepo** with packages in the `packages/` directory:
@@ -133,11 +135,27 @@ pnpm prerelease
133135
## Code Style
134136
135137
- **Formatter/Linter**: Biome (replaces ESLint + Prettier)
136-
- **Target**: ES2022, Node.js 14.21.3+
138+
- **Target**: ES2022, Node.js 16.10.0+ (for `@tinyhttp/app`)
137139
- **Module system**: ESM only (`"type": "module"`)
138140
- **TypeScript**: Strict mode enabled
139141
- Uses `.js` extensions in imports even in TypeScript files (ESM requirement)
140142
143+
### Biome Formatting Rules
144+
145+
- Single quotes, no semicolons
146+
- 2-space indentation, 120 char line width
147+
- No trailing commas
148+
- Bracket spacing enabled
149+
150+
### Node.js Version Requirements by Package
151+
152+
| Node.js Version | Packages | Constraining Feature |
153+
|-----------------|----------|---------------------|
154+
| `>=12.17.0` | content-disposition, cookie, encode-url, forwarded | ES2019 |
155+
| `>=14.0.0` | router | `?.` and `??` (ES2020) |
156+
| `>=14.13.1` | accepts, cookie-signature, etag, jsonp, rate-limit, req, res, send, type-is, url | `node:` prefix |
157+
| `>=16.10.0` | **app**, dotenv, proxy-addr | `Object.hasOwn()` (ES2022) |
158+
141159
## Key Dependencies
142160
143161
- **regexparam** - Path matching (similar to path-to-regexp)

packages/accepts/src/negotiator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function splitMediaTypes(accept: string): string[] {
373373
if (quoteCount(accepts[j]) % 2 === 0) {
374374
accepts[++j] = accepts[i]
375375
} else {
376-
accepts[j] += ',' + accepts[i]
376+
accepts[j] += `,${accepts[i]}`
377377
}
378378
}
379379

@@ -388,7 +388,7 @@ function splitParameters(str: string): string[] {
388388
if (quoteCount(parameters[j]) % 2 === 0) {
389389
parameters[++j] = parameters[i]
390390
} else {
391-
parameters[j] += ';' + parameters[i]
391+
parameters[j] += `;${parameters[i]}`
392392
}
393393
}
394394

@@ -437,7 +437,7 @@ export class Negotiator {
437437
}
438438

439439
mediaTypes(available?: string[]): string[] {
440-
const header = this.#request.headers['accept']
440+
const header = this.#request.headers.accept
441441
const accept = Array.isArray(header) ? header.join(', ') : header
442442
return preferredMediaTypes(accept, available)
443443
}

packages/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"@tinyhttp/req": "workspace:*",
3939
"@tinyhttp/res": "workspace:*",
4040
"@tinyhttp/router": "workspace:*",
41-
"header-range-parser": "1.1.3",
4241
"regexparam": "^2.0.2"
4342
},
4443
"scripts": {

packages/app/src/request.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { isIP } from 'node:net'
44
import type { ParsedUrlQuery } from 'node:querystring'
55
import type { TLSSocket } from 'node:tls'
66
import { all, compile, proxyaddr as proxyAddr, type Trust } from '@tinyhttp/proxy-addr'
7-
import type { URLParams } from '@tinyhttp/req'
7+
import type { RangeParserOptions, RangeParserRanges, URLParams } from '@tinyhttp/req'
88
import type { Middleware } from '@tinyhttp/router'
9-
import type { Options, Ranges } from 'header-range-parser'
109
import type { App } from './app.js'
1110

1211
export { getURLParams } from '@tinyhttp/req'
@@ -136,7 +135,7 @@ export interface Request extends IncomingMessage {
136135
ips?: string[]
137136
subdomains?: string[]
138137
get: <HeaderName extends string>(header: HeaderName) => IncomingHttpHeaders[HeaderName]
139-
range: (size: number, options?: Options) => -1 | -2 | -3 | Ranges | undefined
138+
range: (size: number, options?: RangeParserOptions) => -1 | -2 | -3 | RangeParserRanges | undefined
140139
accepts: (...types: string[]) => AcceptsReturns
141140
acceptsEncodings: (...encodings: string[]) => AcceptsReturns
142141
acceptsCharsets: (...charsets: string[]) => AcceptsReturns

packages/req/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { IncomingHttpHeaders, IncomingMessage as Request, ServerResponse as Response } from 'node:http'
22
import { typeIs } from '@tinyhttp/type-is'
33
import { type Options, parseRange, type Ranges, type Result } from 'header-range-parser'
4+
5+
export type { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult }
6+
47
import { fresh } from './fresh.js'
58

69
export * from '@tinyhttp/url'

packages/res/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@tinyhttp/req": "workspace:*",
3636
"@tinyhttp/send": "workspace:*",
3737
"@tinyhttp/vary": "^0.1.3",
38-
"es-escape-html": "^0.1.1",
3938
"mime": "4.1.0"
4039
},
4140
"files": [

packages/router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"router"
2121
],
2222
"engines": {
23-
"node": ">=12.17.0"
23+
"node": ">=14.0.0"
2424
},
2525
"author": "v1rtl",
2626
"license": "MIT",

pnpm-lock.yaml

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/core/app.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ describe('App settings', () => {
15581558
describe('applyExtensions', () => {
15591559
it('should use custom applyExtensions function when provided', async () => {
15601560
let extensionsCalled = false
1561-
const customExtensions = (req: Request, res: Response, next: () => void) => {
1561+
const customExtensions = (req: Request, _res: Response, next: () => void) => {
15621562
extensionsCalled = true
15631563
;(req as Request & { custom: boolean }).custom = true
15641564
next()

0 commit comments

Comments
 (0)