portless 0.14.0 → 0.15.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 +23 -7
- package/dist/{chunk-OZM4AEYL.js → chunk-SD2PIWJU.js} +52 -8
- package/dist/cli.js +729 -169
- package/dist/index.d.ts +17 -2
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ interface ProxyServerOptions {
|
|
|
14
14
|
proxyPort: number;
|
|
15
15
|
/** TLD suffix used for hostnames (default: "localhost"). */
|
|
16
16
|
tld?: string;
|
|
17
|
+
/** All TLD suffixes used for hostnames. The first one is used for examples. */
|
|
18
|
+
tlds?: string[];
|
|
17
19
|
/**
|
|
18
20
|
* When true, only exact hostname matches are used. Unregistered subdomain
|
|
19
21
|
* prefixes return 404 instead of falling back to the base service.
|
|
@@ -136,7 +138,13 @@ declare class RouteStore {
|
|
|
136
138
|
* merged; the route must already exist (matched by hostname).
|
|
137
139
|
*/
|
|
138
140
|
updateRoute(hostname: string, fields: RouteMetadataPatch): void;
|
|
139
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Remove a route by hostname. When `ownerPid` is provided, the entry is
|
|
143
|
+
* only removed while it is still owned by that pid. Exit cleanups must
|
|
144
|
+
* pass their own pid: after a `--force` takeover the killed process would
|
|
145
|
+
* otherwise deregister the route the new owner just registered.
|
|
146
|
+
*/
|
|
147
|
+
removeRoute(hostname: string, ownerPid?: number): void;
|
|
140
148
|
}
|
|
141
149
|
|
|
142
150
|
/**
|
|
@@ -147,6 +155,8 @@ declare class RouteStore {
|
|
|
147
155
|
declare function fixOwnership(...paths: string[]): void;
|
|
148
156
|
/** Type guard for Node.js system errors with an error code. */
|
|
149
157
|
declare function isErrnoException(err: unknown): err is NodeJS.ErrnoException;
|
|
158
|
+
/** Return whether a process exists, treating permission denial as alive. */
|
|
159
|
+
declare function isProcessAlive(pid: number): boolean;
|
|
150
160
|
/**
|
|
151
161
|
* Escape HTML special characters to prevent XSS.
|
|
152
162
|
*/
|
|
@@ -162,6 +172,11 @@ declare function formatUrl(hostname: string, proxyPort: number, tls?: boolean):
|
|
|
162
172
|
* appends the TLD suffix if needed.
|
|
163
173
|
*/
|
|
164
174
|
declare function parseHostname(input: string, tld?: string): string;
|
|
175
|
+
/**
|
|
176
|
+
* Parse a hostname input for every configured TLD. If the input already ends
|
|
177
|
+
* with one of those TLDs, use the stripped base name for the full set.
|
|
178
|
+
*/
|
|
179
|
+
declare function parseHostnames(input: string, tlds?: readonly string[]): string[];
|
|
165
180
|
|
|
166
181
|
/**
|
|
167
182
|
* Extract the portless-managed block from /etc/hosts content.
|
|
@@ -204,4 +219,4 @@ declare function getManagedHostnames(): string[];
|
|
|
204
219
|
*/
|
|
205
220
|
declare function checkHostResolution(hostname: string): Promise<boolean>;
|
|
206
221
|
|
|
207
|
-
export { DIR_MODE, FILE_MODE, PORTLESS_HEADER, type ProxyServer, type ProxyServerOptions, RouteConflictError, type RouteInfo, type RouteMapping, RouteStore, buildBlock, checkHostResolution, cleanHostsFile, createHttpRedirectServer, createProxyServer, escapeHtml, extractManagedBlock, fixOwnership, formatUrl, getManagedHostnames, isErrnoException, parseHostname, removeBlock, shouldAutoSyncHosts, syncHostsFile };
|
|
222
|
+
export { DIR_MODE, FILE_MODE, PORTLESS_HEADER, type ProxyServer, type ProxyServerOptions, RouteConflictError, type RouteInfo, type RouteMapping, RouteStore, buildBlock, checkHostResolution, cleanHostsFile, createHttpRedirectServer, createProxyServer, escapeHtml, extractManagedBlock, fixOwnership, formatUrl, getManagedHostnames, isErrnoException, isProcessAlive, parseHostname, parseHostnames, removeBlock, shouldAutoSyncHosts, syncHostsFile };
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,13 @@ import {
|
|
|
15
15
|
formatUrl,
|
|
16
16
|
getManagedHostnames,
|
|
17
17
|
isErrnoException,
|
|
18
|
+
isProcessAlive,
|
|
18
19
|
parseHostname,
|
|
20
|
+
parseHostnames,
|
|
19
21
|
removeBlock,
|
|
20
22
|
shouldAutoSyncHosts,
|
|
21
23
|
syncHostsFile
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SD2PIWJU.js";
|
|
23
25
|
export {
|
|
24
26
|
DIR_MODE,
|
|
25
27
|
FILE_MODE,
|
|
@@ -37,7 +39,9 @@ export {
|
|
|
37
39
|
formatUrl,
|
|
38
40
|
getManagedHostnames,
|
|
39
41
|
isErrnoException,
|
|
42
|
+
isProcessAlive,
|
|
40
43
|
parseHostname,
|
|
44
|
+
parseHostnames,
|
|
41
45
|
removeBlock,
|
|
42
46
|
shouldAutoSyncHosts,
|
|
43
47
|
syncHostsFile
|