portless 0.13.1 → 0.15.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/dist/index.d.ts CHANGED
@@ -64,7 +64,16 @@ interface RouteMapping extends RouteInfo {
64
64
  tailscaleUrl?: string;
65
65
  tailscaleHttpsPort?: number;
66
66
  tailscaleFunnel?: boolean;
67
+ ngrokUrl?: string;
68
+ ngrokPid?: number;
67
69
  }
70
+ type RouteMetadataPatch = {
71
+ tailscaleUrl?: string | null;
72
+ tailscaleHttpsPort?: number | null;
73
+ tailscaleFunnel?: boolean | null;
74
+ ngrokUrl?: string | null;
75
+ ngrokPid?: number | null;
76
+ };
68
77
  /**
69
78
  * Thrown when a route is already registered by a live process and --force was
70
79
  * not specified. With --force, the existing process is killed instead.
@@ -126,8 +135,14 @@ declare class RouteStore {
126
135
  * Update metadata on an existing route entry. Only provided fields are
127
136
  * merged; the route must already exist (matched by hostname).
128
137
  */
129
- updateRoute(hostname: string, fields: Partial<Pick<RouteMapping, "tailscaleUrl" | "tailscaleHttpsPort" | "tailscaleFunnel">>): void;
130
- removeRoute(hostname: string): void;
138
+ updateRoute(hostname: string, fields: RouteMetadataPatch): void;
139
+ /**
140
+ * Remove a route by hostname. When `ownerPid` is provided, the entry is
141
+ * only removed while it is still owned by that pid. Exit cleanups must
142
+ * pass their own pid: after a `--force` takeover the killed process would
143
+ * otherwise deregister the route the new owner just registered.
144
+ */
145
+ removeRoute(hostname: string, ownerPid?: number): void;
131
146
  }
132
147
 
133
148
  /**
@@ -138,6 +153,8 @@ declare class RouteStore {
138
153
  declare function fixOwnership(...paths: string[]): void;
139
154
  /** Type guard for Node.js system errors with an error code. */
140
155
  declare function isErrnoException(err: unknown): err is NodeJS.ErrnoException;
156
+ /** Return whether a process exists, treating permission denial as alive. */
157
+ declare function isProcessAlive(pid: number): boolean;
141
158
  /**
142
159
  * Escape HTML special characters to prevent XSS.
143
160
  */
@@ -195,4 +212,4 @@ declare function getManagedHostnames(): string[];
195
212
  */
196
213
  declare function checkHostResolution(hostname: string): Promise<boolean>;
197
214
 
198
- 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 };
215
+ 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, removeBlock, shouldAutoSyncHosts, syncHostsFile };
package/dist/index.js CHANGED
@@ -15,11 +15,12 @@ import {
15
15
  formatUrl,
16
16
  getManagedHostnames,
17
17
  isErrnoException,
18
+ isProcessAlive,
18
19
  parseHostname,
19
20
  removeBlock,
20
21
  shouldAutoSyncHosts,
21
22
  syncHostsFile
22
- } from "./chunk-3WLVQXFE.js";
23
+ } from "./chunk-PCBKLZK2.js";
23
24
  export {
24
25
  DIR_MODE,
25
26
  FILE_MODE,
@@ -37,6 +38,7 @@ export {
37
38
  formatUrl,
38
39
  getManagedHostnames,
39
40
  isErrnoException,
41
+ isProcessAlive,
40
42
  parseHostname,
41
43
  removeBlock,
42
44
  shouldAutoSyncHosts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portless",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
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",