@xylabs/url 4.13.19 → 4.13.21
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 +91 -3
- package/dist/browser/{index.d.ts → index-browser.d.ts} +1 -1
- package/dist/browser/index-browser.d.ts.map +1 -0
- package/dist/browser/{index.mjs → index-browser.mjs} +3 -3
- package/dist/browser/index-browser.mjs.map +1 -0
- package/dist/{neutral/index.d.ts → browser/index-neutral.d.ts} +1 -1
- package/dist/browser/index-neutral.d.ts.map +1 -0
- package/dist/{node/index.d.ts → browser/index-node.d.ts} +1 -1
- package/dist/browser/index-node.d.ts.map +1 -0
- package/dist/browser/lib/index.d.ts.map +1 -1
- package/dist/browser/lib/isLocalhost.d.ts.map +1 -1
- package/dist/browser/lib/spec/isLocalhost.spec.d.ts.map +1 -1
- package/dist/neutral/index-browser.d.ts +11 -0
- package/dist/neutral/index-browser.d.ts.map +1 -0
- package/dist/neutral/index-neutral.d.ts +11 -0
- package/dist/neutral/index-neutral.d.ts.map +1 -0
- package/dist/neutral/{index.mjs → index-neutral.mjs} +3 -3
- package/dist/neutral/index-neutral.mjs.map +1 -0
- package/dist/neutral/index-node.d.ts +3 -0
- package/dist/neutral/index-node.d.ts.map +1 -0
- package/dist/neutral/lib/index.d.ts.map +1 -1
- package/dist/neutral/lib/isLocalhost.d.ts.map +1 -1
- package/dist/neutral/lib/spec/isLocalhost.spec.d.ts.map +1 -1
- package/dist/node/index-browser.d.ts +11 -0
- package/dist/node/index-browser.d.ts.map +1 -0
- package/dist/node/index-neutral.d.ts +11 -0
- package/dist/node/index-neutral.d.ts.map +1 -0
- package/dist/node/index-node.d.ts +3 -0
- package/dist/node/index-node.d.ts.map +1 -0
- package/dist/node/{index.mjs → index-node.mjs} +3 -3
- package/dist/node/index-node.mjs.map +1 -0
- package/dist/node/lib/index.d.ts.map +1 -1
- package/dist/node/lib/isLocalhost.d.ts.map +1 -1
- package/dist/node/lib/spec/isLocalhost.spec.d.ts.map +1 -1
- package/package.json +20 -12
- package/src/lib/spec/isLocalhost.spec.ts +20 -0
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.mjs.map +0 -1
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/neutral/index.mjs.map +0 -1
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.mjs.map +0 -1
- package/src/neutral/lib/index.ts +0 -1
- package/src/neutral/lib/isLocalhost.ts +0 -8
- package/src/node/lib/index.ts +0 -1
- package/src/node/lib/isLocalhost.ts +0 -8
- package/xy.config.ts +0 -12
- /package/src/{browser/index.ts → index-browser.ts} +0 -0
- /package/src/{neutral/index.ts → index-neutral.ts} +0 -0
- /package/src/{node/index.ts → index-node.ts} +0 -0
- /package/src/{browser/lib → lib}/index.ts +0 -0
- /package/src/{browser/lib → lib}/isLocalhost.ts +0 -0
package/README.md
CHANGED
|
@@ -12,13 +12,101 @@
|
|
|
12
12
|
[![snyk-badge][]][snyk-link]
|
|
13
13
|
[![socket-badge][]][socket-link]
|
|
14
14
|
|
|
15
|
-
Version: 4.13.15
|
|
16
15
|
|
|
17
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
18
17
|
|
|
19
|
-
## Documentation
|
|
18
|
+
## API Documentation
|
|
19
|
+
|
|
20
|
+
**@xylabs/url**
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
24
|
+
## Modules
|
|
25
|
+
|
|
26
|
+
- [index-browser](#index-browser/README)
|
|
27
|
+
- [index-neutral](#index-neutral/README)
|
|
28
|
+
- [index-node](#index-node/README)
|
|
29
|
+
|
|
30
|
+
### index-browser
|
|
31
|
+
|
|
32
|
+
### functions
|
|
33
|
+
|
|
34
|
+
### <a id="isLocalhost"></a>isLocalhost
|
|
35
|
+
|
|
36
|
+
[**@xylabs/url**](#../../README)
|
|
37
|
+
|
|
38
|
+
***
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
function isLocalhost(hostname): boolean;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Parameters
|
|
45
|
+
|
|
46
|
+
### hostname
|
|
47
|
+
|
|
48
|
+
`string`
|
|
49
|
+
|
|
50
|
+
## Returns
|
|
51
|
+
|
|
52
|
+
`boolean`
|
|
53
|
+
|
|
54
|
+
### variables
|
|
55
|
+
|
|
56
|
+
### <a id="URL"></a>URL
|
|
57
|
+
|
|
58
|
+
[**@xylabs/url**](#../../README)
|
|
59
|
+
|
|
60
|
+
***
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const URL: (url, base?) => URL;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Parameters
|
|
67
|
+
|
|
68
|
+
### url
|
|
69
|
+
|
|
70
|
+
`string` | `URL`
|
|
71
|
+
|
|
72
|
+
### base?
|
|
73
|
+
|
|
74
|
+
`string` | `URL`
|
|
75
|
+
|
|
76
|
+
## Returns
|
|
77
|
+
|
|
78
|
+
`URL`
|
|
79
|
+
|
|
80
|
+
### index-neutral
|
|
81
|
+
|
|
82
|
+
### variables
|
|
83
|
+
|
|
84
|
+
### <a id="URL"></a>URL
|
|
85
|
+
|
|
86
|
+
[**@xylabs/url**](#../../README)
|
|
87
|
+
|
|
88
|
+
***
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const URL: (url, base?) => URL;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Parameters
|
|
95
|
+
|
|
96
|
+
### url
|
|
97
|
+
|
|
98
|
+
`string` | `URL`
|
|
99
|
+
|
|
100
|
+
### base?
|
|
101
|
+
|
|
102
|
+
`string` | `URL`
|
|
103
|
+
|
|
104
|
+
## Returns
|
|
105
|
+
|
|
106
|
+
`URL`
|
|
107
|
+
|
|
108
|
+
### index-node
|
|
20
109
|
|
|
21
|
-
Coming Soon!
|
|
22
110
|
|
|
23
111
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
24
112
|
|
|
@@ -0,0 +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,12 +1,12 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/lib/isLocalhost.ts
|
|
2
2
|
var isLocalhost = (hostname) => {
|
|
3
3
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
// src/browser
|
|
6
|
+
// src/index-browser.ts
|
|
7
7
|
var BrowserUrl = URL;
|
|
8
8
|
export {
|
|
9
9
|
BrowserUrl as URL,
|
|
10
10
|
isLocalhost
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=index.mjs.map
|
|
12
|
+
//# sourceMappingURL=index-browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-browser.ts"],"sourcesContent":["export 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\" />\nconst BrowserUrl = URL\nexport { BrowserUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,IAAM,aAAa;","names":[]}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/
|
|
1
|
+
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/isLocalhost.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const BrowserUrl: {
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
|
+
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
5
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
7
|
+
revokeObjectURL(url: string): void;
|
|
8
|
+
};
|
|
9
|
+
export { BrowserUrl as URL };
|
|
10
|
+
export * from './lib/index.ts';
|
|
11
|
+
//# sourceMappingURL=index-browser.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const NeutralUrl: {
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
|
+
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
5
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
7
|
+
revokeObjectURL(url: string): void;
|
|
8
|
+
};
|
|
9
|
+
export { NeutralUrl as URL };
|
|
10
|
+
export * from './lib/index.ts';
|
|
11
|
+
//# sourceMappingURL=index-neutral.d.ts.map
|
|
@@ -0,0 +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,12 +1,12 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/lib/isLocalhost.ts
|
|
2
2
|
var isLocalhost = (hostname) => {
|
|
3
3
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
// src/neutral
|
|
6
|
+
// src/index-neutral.ts
|
|
7
7
|
var NeutralUrl = URL;
|
|
8
8
|
export {
|
|
9
9
|
NeutralUrl as URL,
|
|
10
10
|
isLocalhost
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=index.mjs.map
|
|
12
|
+
//# sourceMappingURL=index-neutral.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-neutral.ts"],"sourcesContent":["export 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\" />\nconst NeutralUrl = URL\nexport { NeutralUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,IAAM,aAAa;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/
|
|
1
|
+
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/isLocalhost.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const BrowserUrl: {
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
|
+
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
5
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
7
|
+
revokeObjectURL(url: string): void;
|
|
8
|
+
};
|
|
9
|
+
export { BrowserUrl as URL };
|
|
10
|
+
export * from './lib/index.ts';
|
|
11
|
+
//# sourceMappingURL=index-browser.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const NeutralUrl: {
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
|
+
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
5
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
7
|
+
revokeObjectURL(url: string): void;
|
|
8
|
+
};
|
|
9
|
+
export { NeutralUrl as URL };
|
|
10
|
+
export * from './lib/index.ts';
|
|
11
|
+
//# sourceMappingURL=index-neutral.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/lib/isLocalhost.ts
|
|
2
2
|
var isLocalhost = (hostname) => {
|
|
3
3
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
// src/node
|
|
6
|
+
// src/index-node.ts
|
|
7
7
|
import { URL } from "url";
|
|
8
8
|
export {
|
|
9
9
|
URL,
|
|
10
10
|
isLocalhost
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=index.mjs.map
|
|
12
|
+
//# sourceMappingURL=index-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/isLocalhost.ts","../../src/index-node.ts"],"sourcesContent":["export 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","export * from './lib/index.ts'\nexport { URL } from 'node:url'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,SAAS,WAAW;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.d.ts","sourceRoot":"","sources":["../../../src/
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/
|
|
1
|
+
{"version":3,"file":"isLocalhost.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/isLocalhost.spec.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/url",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.21",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"url",
|
|
@@ -29,27 +29,35 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"browser": {
|
|
32
|
-
"types": "./dist/browser/index.d.ts",
|
|
33
|
-
"
|
|
32
|
+
"types": "./dist/browser/index-browser.d.ts",
|
|
33
|
+
"source": "./src/index-browser.ts",
|
|
34
|
+
"default": "./dist/browser/index-browser.mjs"
|
|
34
35
|
},
|
|
35
36
|
"neutral": {
|
|
36
|
-
"types": "./dist/neutral/index.d.ts",
|
|
37
|
-
"
|
|
37
|
+
"types": "./dist/neutral/index-neutral.d.ts",
|
|
38
|
+
"source": "./src/index-neutral.ts",
|
|
39
|
+
"default": "./dist/neutral/index-neutral.mjs"
|
|
38
40
|
},
|
|
39
41
|
"node": {
|
|
40
|
-
"types": "./dist/node/index.d.ts",
|
|
41
|
-
"
|
|
42
|
+
"types": "./dist/node/index-node.d.ts",
|
|
43
|
+
"source": "./src/index-node.ts",
|
|
44
|
+
"default": "./dist/node/index-node.mjs"
|
|
42
45
|
}
|
|
43
46
|
},
|
|
44
47
|
"./package.json": "./package.json"
|
|
45
48
|
},
|
|
46
|
-
"module": "./dist/neutral/index.mjs",
|
|
47
|
-
"
|
|
49
|
+
"module": "./dist/neutral/index-neutral.mjs",
|
|
50
|
+
"source": "./src/index-neutral.ts",
|
|
51
|
+
"types": "./dist/neutral/index-neutral.d.ts",
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"src"
|
|
55
|
+
],
|
|
48
56
|
"devDependencies": {
|
|
49
57
|
"@types/node": "^24.0.14",
|
|
50
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0
|
|
51
|
-
"@xylabs/tsconfig": "^7.0.0
|
|
52
|
-
"@xylabs/tsconfig-dom": "^7.0.0
|
|
58
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0",
|
|
59
|
+
"@xylabs/tsconfig": "^7.0.0",
|
|
60
|
+
"@xylabs/tsconfig-dom": "^7.0.0",
|
|
53
61
|
"typescript": "^5.8.3",
|
|
54
62
|
"vitest": "^3.2.4"
|
|
55
63
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describe, expect, it,
|
|
3
|
+
} from 'vitest'
|
|
4
|
+
|
|
5
|
+
import { isLocalhost } from '../isLocalhost.ts'
|
|
6
|
+
|
|
7
|
+
describe('is.ts type guards', () => {
|
|
8
|
+
describe('isLocalhost', () => {
|
|
9
|
+
it('correctly identifies localhost strings', () => {
|
|
10
|
+
expect(isLocalhost('localhost')).toBe(true)
|
|
11
|
+
expect(isLocalhost('127.0.0.1')).toBe(true)
|
|
12
|
+
expect(isLocalhost('::1')).toBe(true)
|
|
13
|
+
expect(isLocalhost('example.localhost')).toBe(true)
|
|
14
|
+
|
|
15
|
+
expect(isLocalhost('example.com')).toBe(false)
|
|
16
|
+
expect(isLocalhost('')).toBe(false)
|
|
17
|
+
expect(isLocalhost('local')).toBe(false)
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/browser/lib/isLocalhost.ts","../../src/browser/index.ts"],"sourcesContent":["export 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\" />\nconst BrowserUrl = URL\nexport { BrowserUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,IAAM,aAAa;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/neutral/index.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;;;;CAAM,CAAA;AACtB,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neutral/lib/isLocalhost.ts","../../src/neutral/index.ts"],"sourcesContent":["export 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\" />\nconst NeutralUrl = URL\nexport { NeutralUrl as URL }\nexport * from './lib/index.ts'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,IAAM,aAAa;","names":[]}
|
package/dist/node/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node/lib/isLocalhost.ts","../../src/node/index.ts"],"sourcesContent":["export 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","export * from './lib/index.ts'\nexport { URL } from 'node:url'\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,aAA8B;AACxD,SACE,aAAa,eACV,aAAa,eACb,aAAa,SACb,SAAS,SAAS,YAAY;AAErC;;;ACNA,SAAS,WAAW;","names":[]}
|
package/src/neutral/lib/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './isLocalhost.ts'
|
package/src/node/lib/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './isLocalhost.ts'
|
package/xy.config.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
|
|
2
|
-
|
|
3
|
-
const config: XyTsupConfig = {
|
|
4
|
-
compile: {
|
|
5
|
-
browser: { 'src/browser': true },
|
|
6
|
-
mode: 'tsup',
|
|
7
|
-
neutral: { 'src/neutral': true },
|
|
8
|
-
node: { 'src/node': true },
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default config
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|