@xylabs/url 5.0.83 → 5.0.86
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 +36 -31
- package/dist/browser/index-browser.d.ts +1 -0
- package/dist/browser/index-browser.d.ts.map +1 -1
- package/dist/browser/index-browser.mjs.map +1 -1
- package/dist/browser/index-neutral.d.ts +1 -0
- package/dist/browser/index-neutral.d.ts.map +1 -1
- package/dist/browser/index-node.d.ts +1 -0
- package/dist/browser/index-node.d.ts.map +1 -1
- package/dist/browser/lib/isLocalhost.d.ts +5 -0
- package/dist/browser/lib/isLocalhost.d.ts.map +1 -1
- package/dist/neutral/index-browser.d.ts +1 -0
- package/dist/neutral/index-browser.d.ts.map +1 -1
- package/dist/neutral/index-neutral.d.ts +1 -0
- package/dist/neutral/index-neutral.d.ts.map +1 -1
- package/dist/neutral/index-neutral.mjs.map +1 -1
- package/dist/neutral/index-node.d.ts +1 -0
- package/dist/neutral/index-node.d.ts.map +1 -1
- package/dist/neutral/lib/isLocalhost.d.ts +5 -0
- package/dist/neutral/lib/isLocalhost.d.ts.map +1 -1
- package/dist/node/index-browser.d.ts +1 -0
- package/dist/node/index-browser.d.ts.map +1 -1
- package/dist/node/index-neutral.d.ts +1 -0
- package/dist/node/index-neutral.d.ts.map +1 -1
- package/dist/node/index-node.d.ts +1 -0
- package/dist/node/index-node.d.ts.map +1 -1
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/lib/isLocalhost.d.ts +5 -0
- package/dist/node/lib/isLocalhost.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/url**
|
|
@@ -23,9 +25,11 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Modules
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
| Module | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [index-browser](#index-browser/README) | - |
|
|
31
|
+
| [index-neutral](#index-neutral/README) | - |
|
|
32
|
+
| [index-node](#index-node/README) | - |
|
|
29
33
|
|
|
30
34
|
### index-browser
|
|
31
35
|
|
|
@@ -38,19 +42,23 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
38
42
|
***
|
|
39
43
|
|
|
40
44
|
```ts
|
|
41
|
-
function isLocalhost(hostname): boolean;
|
|
45
|
+
function isLocalhost(hostname: string): boolean;
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
## Parameters
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
| Parameter | Type | Description |
|
|
53
|
+
| ------ | ------ | ------ |
|
|
54
|
+
| `hostname` | `string` | The hostname to check |
|
|
49
55
|
|
|
50
56
|
## Returns
|
|
51
57
|
|
|
52
58
|
`boolean`
|
|
53
59
|
|
|
60
|
+
`true` if the hostname is a localhost address
|
|
61
|
+
|
|
54
62
|
### variables
|
|
55
63
|
|
|
56
64
|
### <a id="URL"></a>URL
|
|
@@ -60,18 +68,17 @@ function isLocalhost(hostname): boolean;
|
|
|
60
68
|
***
|
|
61
69
|
|
|
62
70
|
```ts
|
|
63
|
-
const URL: (url, base
|
|
71
|
+
const URL: (url: string | URL, base?: string | URL) => URL;
|
|
64
72
|
```
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### url
|
|
74
|
+
Browser-specific URL class, aliased from the global `URL`.
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### base?
|
|
76
|
+
## Parameters
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
| Parameter | Type |
|
|
79
|
+
| ------ | ------ |
|
|
80
|
+
| `url` | `string` \| `URL` |
|
|
81
|
+
| `base?` | `string` \| `URL` |
|
|
75
82
|
|
|
76
83
|
## Returns
|
|
77
84
|
|
|
@@ -88,18 +95,17 @@ const URL: (url, base?) => URL;
|
|
|
88
95
|
***
|
|
89
96
|
|
|
90
97
|
```ts
|
|
91
|
-
const URL: (url, base
|
|
98
|
+
const URL: (url: string | URL, base?: string | URL) => URL;
|
|
92
99
|
```
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### url
|
|
101
|
+
Platform-neutral URL class, aliased from the global `URL`.
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### base?
|
|
103
|
+
## Parameters
|
|
101
104
|
|
|
102
|
-
|
|
105
|
+
| Parameter | Type |
|
|
106
|
+
| ------ | ------ |
|
|
107
|
+
| `url` | `string` \| `URL` |
|
|
108
|
+
| `base?` | `string` \| `URL` |
|
|
103
109
|
|
|
104
110
|
## Returns
|
|
105
111
|
|
|
@@ -116,18 +122,17 @@ const URL: (url, base?) => URL;
|
|
|
116
122
|
***
|
|
117
123
|
|
|
118
124
|
```ts
|
|
119
|
-
const URL: (url, base
|
|
125
|
+
const URL: (url: string | URL, base?: string | URL) => URL;
|
|
120
126
|
```
|
|
121
127
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### url
|
|
128
|
+
Node.js-specific URL class, imported from the `node:url` module.
|
|
125
129
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
### base?
|
|
130
|
+
## Parameters
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
| Parameter | Type |
|
|
133
|
+
| ------ | ------ |
|
|
134
|
+
| `url` | `string` \| `URL` |
|
|
135
|
+
| `base?` | `string` \| `URL` |
|
|
131
136
|
|
|
132
137
|
## Returns
|
|
133
138
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-browser.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-browser.ts"],"sourcesContent":["/**\n * Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).\n * @param hostname - The hostname to check\n * @returns `true` if the hostname is a localhost address\n */\nexport const isLocalhost = (hostname: string): boolean => {\n return (\n hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname === '::1' // IPv6 localhost\n || hostname.endsWith('.localhost')\n )\n}\n","/// <reference lib=\"dom\" />\n/** Browser-specific URL class, aliased from the global `URL`. */\nconst BrowserUrl = URL\nexport { BrowserUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAKO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACVA,IAAM,aAAa;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,uEAAuE;AACvE,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).
|
|
3
|
+
* @param hostname - The hostname to check
|
|
4
|
+
* @returns `true` if the hostname is a localhost address
|
|
5
|
+
*/
|
|
1
6
|
export declare const isLocalhost: (hostname: string) => boolean;
|
|
2
7
|
//# sourceMappingURL=isLocalhost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
|
1
|
+
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-neutral.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-neutral.ts"],"sourcesContent":["/**\n * Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).\n * @param hostname - The hostname to check\n * @returns `true` if the hostname is a localhost address\n */\nexport const isLocalhost = (hostname: string): boolean => {\n return (\n hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname === '::1' // IPv6 localhost\n || hostname.endsWith('.localhost')\n )\n}\n","/// <reference lib=\"dom\" />\n/** Platform-neutral URL class, aliased from the global `URL`. */\nconst NeutralUrl = URL\nexport { NeutralUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAKO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACVA,IAAM,aAAa;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,uEAAuE;AACvE,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).
|
|
3
|
+
* @param hostname - The hostname to check
|
|
4
|
+
* @returns `true` if the hostname is a localhost address
|
|
5
|
+
*/
|
|
1
6
|
export declare const isLocalhost: (hostname: string) => boolean;
|
|
2
7
|
//# sourceMappingURL=isLocalhost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
|
1
|
+
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-neutral.d.ts","sourceRoot":"","sources":["../../src/index-neutral.ts"],"names":[],"mappings":"AACA,iEAAiE;AACjE,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,uEAAuE;AACvE,QAAA,MAAM,OAAO;;;;;;;CAAM,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-node.ts","../../src/lib/isLocalhost.ts"],"sourcesContent":["import { URL } from 'node:url'\n\nconst NodeUrl = URL\nexport { NodeUrl as URL }\nexport * from './lib/index.ts'\n","
|
|
1
|
+
{"version":3,"sources":["../../src/index-node.ts","../../src/lib/isLocalhost.ts"],"sourcesContent":["import { URL } from 'node:url'\n\n/** Node.js-specific URL class, imported from the `node:url` module. */\nconst NodeUrl = URL\nexport { NodeUrl as URL }\nexport * from './lib/index.ts'\n","/**\n * Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).\n * @param hostname - The hostname to check\n * @returns `true` if the hostname is a localhost address\n */\nexport const isLocalhost = (hostname: string): boolean => {\n return (\n hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname === '::1' // IPv6 localhost\n || hostname.endsWith('.localhost')\n )\n}\n"],"mappings":";AAAA,SAAS,WAAW;;;ACKb,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ADTA,IAAM,UAAU;","names":[]}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a hostname refers to the local machine (localhost, 127.0.0.1, ::1, or *.localhost).
|
|
3
|
+
* @param hostname - The hostname to check
|
|
4
|
+
* @returns `true` if the hostname is a localhost address
|
|
5
|
+
*/
|
|
1
6
|
export declare const isLocalhost: (hostname: string) => boolean;
|
|
2
7
|
//# sourceMappingURL=isLocalhost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
|
1
|
+
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/lib/isLocalhost.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,OAO9C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/url",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"url",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "~25.4.0",
|
|
56
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
57
|
-
"@xylabs/tsconfig": "~7.4.
|
|
56
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
57
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
58
58
|
"typescript": "~5.9.3",
|
|
59
59
|
"vitest": "~4.0.18"
|
|
60
60
|
},
|