@verdaccio/url 13.0.0-next-8.38 → 13.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 +45 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,6 +15,51 @@
|
|
|
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/url` package provides URL validation, manipulation, and protocol detection utilities for the Verdaccio registry. It handles public URL generation, proxy header parsing, and URL prefix normalization.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @verdaccio/url
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import {
|
|
34
|
+
combineBaseUrl,
|
|
35
|
+
getPublicUrl,
|
|
36
|
+
getWebProtocol,
|
|
37
|
+
isHost,
|
|
38
|
+
isURLhasValidProtocol,
|
|
39
|
+
validateURL,
|
|
40
|
+
wrapPrefix,
|
|
41
|
+
} from '@verdaccio/url';
|
|
42
|
+
|
|
43
|
+
// Get the public URL for the registry
|
|
44
|
+
const publicUrl = getPublicUrl('/verdaccio/', requestOptions);
|
|
45
|
+
|
|
46
|
+
// Validate URL protocol
|
|
47
|
+
isURLhasValidProtocol('https://registry.npmjs.org/'); // true
|
|
48
|
+
|
|
49
|
+
// Combine base URL components
|
|
50
|
+
const baseUrl = combineBaseUrl('https', 'localhost:4873', '/prefix/');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### API
|
|
54
|
+
|
|
55
|
+
- **`getPublicUrl(urlPrefix, requestOptions)`** - Gets public URL from environment variable `VERDACCIO_PUBLIC_URL` or request headers
|
|
56
|
+
- **`isURLhasValidProtocol(uri)`** - Checks if URL starts with `http://`, `https://`, or `//`
|
|
57
|
+
- **`isHost(url, options)`** - Validates if a string is a valid host
|
|
58
|
+
- **`getWebProtocol(headerProtocol, protocol)`** - Detects running protocol from headers (supports HAProxy)
|
|
59
|
+
- **`wrapPrefix(prefix)`** - Normalizes URL prefix to `/prefix/` format
|
|
60
|
+
- **`combineBaseUrl(protocol, host, prefix)`** - Creates full base registry URL
|
|
61
|
+
- **`validateURL(publicUrl)`** - Validates a full URL with protocol
|
|
62
|
+
|
|
18
63
|
## Donations
|
|
19
64
|
|
|
20
65
|
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/url",
|
|
3
|
-
"version": "13.0.0
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Verdaccio URL Utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"private",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/core": "8.0.0
|
|
36
|
+
"@verdaccio/core": "8.0.0",
|
|
37
37
|
"debug": "4.4.3",
|
|
38
38
|
"validator": "13.15.26"
|
|
39
39
|
},
|