@verdaccio/middleware 8.0.0-next-8.38 → 8.0.1
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 +62 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -15,6 +15,68 @@
|
|
|
15
15
|
[](https://hub.docker.com/r/verdaccio/verdaccio)
|
|
16
16
|
[](https://github.com/verdaccio/verdaccio/stargazers)
|
|
17
17
|
|
|
18
|
+
> **Note:** This package is mostly for internal use by Verdaccio and is only intended to be used with Verdaccio 6.x.
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
The `@verdaccio/middleware` package provides Express middleware functions for the Verdaccio registry server. It includes request validation, logging, error handling, rate limiting, security headers, and web UI rendering.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @verdaccio/middleware
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import {
|
|
34
|
+
allow,
|
|
35
|
+
antiLoop,
|
|
36
|
+
encodeScopePackage,
|
|
37
|
+
errorReportingMiddleware,
|
|
38
|
+
expectJson,
|
|
39
|
+
handleError,
|
|
40
|
+
log,
|
|
41
|
+
match,
|
|
42
|
+
media,
|
|
43
|
+
rateLimit,
|
|
44
|
+
registerBodyParser,
|
|
45
|
+
validateName,
|
|
46
|
+
validatePackage,
|
|
47
|
+
webMiddleware,
|
|
48
|
+
} from '@verdaccio/middleware';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### API
|
|
52
|
+
|
|
53
|
+
#### Validation & Processing
|
|
54
|
+
|
|
55
|
+
- **`validateName`** - Validates package names in route parameters
|
|
56
|
+
- **`validatePackage`** - Validates package identifiers
|
|
57
|
+
- **`media`** - Content-type media handler
|
|
58
|
+
- **`expectJson`** - Ensures request content-type is JSON
|
|
59
|
+
- **`encodeScopePackage`** - Encodes scoped package names
|
|
60
|
+
|
|
61
|
+
#### Request Control
|
|
62
|
+
|
|
63
|
+
- **`match(regexp)`** - Route matching middleware
|
|
64
|
+
- **`antiLoop`** - Prevents circular proxy requests
|
|
65
|
+
- **`allow`** - Authorization middleware
|
|
66
|
+
- **`rateLimit`** - Rate limiting middleware
|
|
67
|
+
- **`registerBodyParser(app)`** - Registers JSON body parser
|
|
68
|
+
|
|
69
|
+
#### Web UI
|
|
70
|
+
|
|
71
|
+
- **`webMiddleware()`** - Web UI Express middleware
|
|
72
|
+
- **`setSecurityWebHeaders(res)`** - Sets security headers for the web UI
|
|
73
|
+
|
|
74
|
+
#### Logging & Error Handling
|
|
75
|
+
|
|
76
|
+
- **`log()`** - Request logging middleware
|
|
77
|
+
- **`errorReportingMiddleware(logger)`** - Error reporting middleware
|
|
78
|
+
- **`handleError(err, req, res, next)`** - Error handler
|
|
79
|
+
|
|
18
80
|
## Donations
|
|
19
81
|
|
|
20
82
|
Verdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/middleware",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Verdaccio Express Middleware",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/config": "8.
|
|
37
|
-
"@verdaccio/core": "8.
|
|
38
|
-
"@verdaccio/url": "13.0.
|
|
36
|
+
"@verdaccio/config": "8.1.0",
|
|
37
|
+
"@verdaccio/core": "8.1.0",
|
|
38
|
+
"@verdaccio/url": "13.0.1",
|
|
39
39
|
"debug": "4.4.3",
|
|
40
40
|
"express": "4.22.1",
|
|
41
41
|
"express-rate-limit": "5.5.1",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"url": "https://opencollective.com/verdaccio"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@verdaccio/logger": "8.0.
|
|
51
|
-
"@verdaccio/types": "13.0.0
|
|
50
|
+
"@verdaccio/logger": "8.0.1",
|
|
51
|
+
"@verdaccio/types": "13.0.0",
|
|
52
52
|
"http-errors": "2.0.1",
|
|
53
53
|
"supertest": "7.1.4",
|
|
54
54
|
"jsdom": "26.1.0",
|
|
55
|
-
"vitest": "
|
|
55
|
+
"vitest": "4.1.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"clean": "rimraf ./build",
|