portless 0.4.2 → 0.5.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 +260 -0
- package/dist/chunk-P3DHZHEZ.js +1091 -0
- package/dist/cli.js +839 -252
- package/dist/index.d.ts +37 -1
- package/dist/index.js +17 -3
- package/package.json +3 -3
- package/dist/chunk-JMRTQAVX.js +0 -783
package/dist/index.d.ts
CHANGED
|
@@ -119,4 +119,40 @@ declare function formatUrl(hostname: string, proxyPort: number, tls?: boolean):
|
|
|
119
119
|
*/
|
|
120
120
|
declare function parseHostname(input: string): string;
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Extract the portless-managed block from /etc/hosts content.
|
|
124
|
+
* Returns the lines between the markers (exclusive), or an empty array
|
|
125
|
+
* if no managed block exists.
|
|
126
|
+
*/
|
|
127
|
+
declare function extractManagedBlock(content: string): string[];
|
|
128
|
+
/**
|
|
129
|
+
* Remove the portless-managed block from /etc/hosts content and return
|
|
130
|
+
* the cleaned content with trailing newlines normalized.
|
|
131
|
+
*/
|
|
132
|
+
declare function removeBlock(content: string): string;
|
|
133
|
+
/**
|
|
134
|
+
* Build a portless-managed block for the given hostnames.
|
|
135
|
+
*/
|
|
136
|
+
declare function buildBlock(hostnames: string[]): string;
|
|
137
|
+
/**
|
|
138
|
+
* Sync /etc/hosts to include entries for all given hostnames.
|
|
139
|
+
* Replaces any existing portless-managed block. Requires root access.
|
|
140
|
+
* Returns true on success, false on failure.
|
|
141
|
+
*/
|
|
142
|
+
declare function syncHostsFile(hostnames: string[]): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Remove the portless-managed block from /etc/hosts.
|
|
145
|
+
* Returns true on success, false on failure.
|
|
146
|
+
*/
|
|
147
|
+
declare function cleanHostsFile(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Return the current portless-managed hostnames from /etc/hosts.
|
|
150
|
+
*/
|
|
151
|
+
declare function getManagedHostnames(): string[];
|
|
152
|
+
/**
|
|
153
|
+
* Check whether a .localhost subdomain resolves to 127.0.0.1 via the
|
|
154
|
+
* system DNS resolver. Returns true if resolution works, false otherwise.
|
|
155
|
+
*/
|
|
156
|
+
declare function checkLocalhostResolution(hostname: string): Promise<boolean>;
|
|
157
|
+
|
|
158
|
+
export { DIR_MODE, FILE_MODE, PORTLESS_HEADER, type ProxyServer, type ProxyServerOptions, RouteConflictError, type RouteInfo, type RouteMapping, RouteStore, SYSTEM_DIR_MODE, SYSTEM_FILE_MODE, buildBlock, checkLocalhostResolution, cleanHostsFile, createProxyServer, escapeHtml, extractManagedBlock, fixOwnership, formatUrl, getManagedHostnames, isErrnoException, parseHostname, removeBlock, syncHostsFile };
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,20 @@ import {
|
|
|
6
6
|
RouteStore,
|
|
7
7
|
SYSTEM_DIR_MODE,
|
|
8
8
|
SYSTEM_FILE_MODE,
|
|
9
|
+
buildBlock,
|
|
10
|
+
checkLocalhostResolution,
|
|
11
|
+
cleanHostsFile,
|
|
9
12
|
createProxyServer,
|
|
10
13
|
escapeHtml,
|
|
14
|
+
extractManagedBlock,
|
|
11
15
|
fixOwnership,
|
|
12
16
|
formatUrl,
|
|
17
|
+
getManagedHostnames,
|
|
13
18
|
isErrnoException,
|
|
14
|
-
parseHostname
|
|
15
|
-
|
|
19
|
+
parseHostname,
|
|
20
|
+
removeBlock,
|
|
21
|
+
syncHostsFile
|
|
22
|
+
} from "./chunk-P3DHZHEZ.js";
|
|
16
23
|
export {
|
|
17
24
|
DIR_MODE,
|
|
18
25
|
FILE_MODE,
|
|
@@ -21,10 +28,17 @@ export {
|
|
|
21
28
|
RouteStore,
|
|
22
29
|
SYSTEM_DIR_MODE,
|
|
23
30
|
SYSTEM_FILE_MODE,
|
|
31
|
+
buildBlock,
|
|
32
|
+
checkLocalhostResolution,
|
|
33
|
+
cleanHostsFile,
|
|
24
34
|
createProxyServer,
|
|
25
35
|
escapeHtml,
|
|
36
|
+
extractManagedBlock,
|
|
26
37
|
fixOwnership,
|
|
27
38
|
formatUrl,
|
|
39
|
+
getManagedHostnames,
|
|
28
40
|
isErrnoException,
|
|
29
|
-
parseHostname
|
|
41
|
+
parseHostname,
|
|
42
|
+
removeBlock,
|
|
43
|
+
syncHostsFile
|
|
30
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "portless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Replace port numbers with stable, named .localhost URLs. For humans and agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dev": "tsup --watch",
|
|
30
30
|
"lint": "eslint src/",
|
|
31
31
|
"lint:fix": "eslint src/ --fix",
|
|
32
|
-
"prepublishOnly": "pnpm build",
|
|
32
|
+
"prepublishOnly": "cp ../../README.md . && pnpm build",
|
|
33
33
|
"test": "vitest run",
|
|
34
34
|
"test:coverage": "vitest run --coverage",
|
|
35
35
|
"test:watch": "vitest",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "https://github.com/vercel-labs/portless.git"
|
|
49
49
|
},
|
|
50
|
-
"homepage": "https://
|
|
50
|
+
"homepage": "https://port1355.dev",
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/vercel-labs/portless/issues"
|
|
53
53
|
},
|