@hamedb89/localghost 0.5.0 → 0.6.2
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 +5 -1
- package/dist/cli.js +427 -321
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +147 -107
- package/dist/index.js +1511 -1407
- package/dist/index.js.map +1 -1
- package/dist/{tunnel-BA52DD9e.d.ts → tunnel-DHYPpsX2.d.ts} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +35 -1
- package/dist/vite.js.map +1 -1
- package/docs/ghost-tunnel.md +9 -3
- package/docs/localghost.1.md +10 -0
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DevHostEntry,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DevHostEntry$1, a as ConstructGhostTunnelUrlInput, b as GhostTunnelTransportOptions, c as GhostTunnelTransportConfig, G as GhostTunnelOptions, d as GhostTunnelConfig, e as GhostTunnelRoute, R as ReadDevHostsOptions$1, C as ConfigPattern } from './tunnel-DHYPpsX2.js';
|
|
2
|
+
export { f as GhostTunnelAdapterOptions, g as GhostTunnelAdapterProvider, h as GhostTunnelAdapterStrategy, i as GhostTunnelAdapterTransport, j as GhostTunnelDisplayDefaults, k as GhostTunnelDomainOptions, l as GhostTunnelMode, m as GhostTunnelNamespaceConfig, n as GhostTunnelNamespaceOptions, o as GhostTunnelNamespaceTag, p as GhostTunnelNamespaceValues, q as GhostTunnelPreviewOptions, r as GhostTunnelTransportKind, s as GhostTunnelTunnelStoreEnv, t as GhostTunnelTunnelStoreOptions, u as GhostTunnelTunnelStoreProvider, L as LOCALGHOST_CONFIG_FILE, v as ResolvedDevHostsPath, w as assertSecureGhostTunnelRequest, x as constructGhostTunnelHost, y as constructGhostTunnelURL, z as constructGhostTunnelUrl, A as findLocalMdnsHosts, B as getConfigFileCandidates, E as getDevHostsPath, F as getGhostTunnelDefaultDisplayUrl, H as getGhostTunnelDisplayUrl, I as getGhostTunnelDisplayUrls, J as getGhostTunnelEntryHost, K as getGhostTunnelPreviewUrl, M as getGhostTunnelWildcardHost, N as getProjectName, O as parseDevHosts, P as parseGhostTunnelHost, Q as readDevHosts, S as resolveDevHostsPath, T as resolveGhostTunnelConfig, U as sanitizeProjectName } from './tunnel-DHYPpsX2.js';
|
|
3
3
|
import * as execa from 'execa';
|
|
4
4
|
import { ChildProcess } from 'node:child_process';
|
|
5
5
|
|
|
@@ -23,7 +23,7 @@ type LocalghostRunRecord = {
|
|
|
23
23
|
requestedPort?: number;
|
|
24
24
|
port?: number;
|
|
25
25
|
dynamicPort?: boolean;
|
|
26
|
-
entries: DevHostEntry[];
|
|
26
|
+
entries: DevHostEntry$1[];
|
|
27
27
|
};
|
|
28
28
|
type LocalghostSetupRecord = {
|
|
29
29
|
id: string;
|
|
@@ -33,7 +33,7 @@ type LocalghostSetupRecord = {
|
|
|
33
33
|
configPath?: string;
|
|
34
34
|
caddyfilePath?: string;
|
|
35
35
|
https?: boolean;
|
|
36
|
-
entries: DevHostEntry[];
|
|
36
|
+
entries: DevHostEntry$1[];
|
|
37
37
|
};
|
|
38
38
|
type LocalghostActivity = {
|
|
39
39
|
version: typeof LOCALGHOST_ACTIVITY_VERSION;
|
|
@@ -75,14 +75,6 @@ declare function renderCompactLocalghostBanner(): string;
|
|
|
75
75
|
declare const LOCALGHOST_AGENT_GUIDE = "# Localghost agent guide\n\nLocalghost owns the local development proxy and the app process boundary.\n\n## Preferred repository setup\n\nFor a normal repository with Localghost installed as a dev dependency, use this package script:\n\n \"dev\": \"localghost\"\n\nIf the repository does not have a local CLI yet, use the package-manager launcher:\n\n npm exec --yes --package=@hamedb89/localghost -- localghost\n pnpm dlx @hamedb89/localghost\n yarn dlx @hamedb89/localghost\n bunx --package @hamedb89/localghost localghost\n\nFor an explicit app command, keep the raw command separate:\n\n \"dev\": \"localghost run -- vite\"\n \"dev:raw\": \"vite\"\n\nUse `localghost dev` only when the Caddy proxy should run without starting the app.\n\n## Useful commands\n\n- `localghost`: detect and run the repository development command.\n- `localghost run -- <command>`: wrap an explicit app command.\n- `localghost dev`: run only the local Caddy proxy.\n- `localghost status --ready`: check project setup.\n- `localghost repair`: repair managed hosts and Caddy setup.\n- `localghost ps --json`: inspect Localghost-managed repositories, instances, and ports.\n- `localghost routes`: inspect hostname-to-port routing.\n- `localghost doctor`: check machine prerequisites, ports, and registry state.\n- `localghost repair --reallocate-port`: move an occupied project port to a stable available port.\n\n- `localghost update`: check npm for a newer Localghost release.\n- `localghost upgrade`: install or update Localghost as a repository dev dependency.\n\nUse `localghost` directly when the package is installed locally. Use `npm exec --yes --package=@hamedb89/localghost -- localghost <command>`, `pnpm dlx @hamedb89/localghost <command>`, `yarn dlx @hamedb89/localghost <command>`, or `bunx --package @hamedb89/localghost localghost <command>` when it is not.\n\n## Configuration\n\n- Commit repository defaults in `localghost.config.mjs`.\n- Keep hostname and requested-port routes in `.localghost`.\n- CLI flags override repository configuration for one invocation.\n- Localghost remembers active project and instance port assignments in user state under `~/.localghost`.\n- Do not edit the registry manually and do not start Caddy separately.\n\n## Port behavior\n\nLocalghost remembers ports by canonical repository path and instance key. Concurrent Localghost instances receive distinct ports. The operating-system bind check remains authoritative when another tool already owns a port.\n";
|
|
76
76
|
declare function formatLocalghostAgentGuide(format?: "text" | "json"): string;
|
|
77
77
|
|
|
78
|
-
declare const LOCALGHOST_GHOST_TUNNEL_FILE = ".ghosttunnel";
|
|
79
|
-
type ReadGhostTunnelOptions = ReadDevHostsOptions;
|
|
80
|
-
declare function resolveGhostTunnelPath(options?: ReadGhostTunnelOptions | string): ResolvedDevHostsPath;
|
|
81
|
-
declare function getGhostTunnelPath(options?: ReadGhostTunnelOptions | string): string;
|
|
82
|
-
declare function readGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
|
|
83
|
-
declare function listGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
|
|
84
|
-
declare function findGhostTunnelEntry(host: string, options?: ReadGhostTunnelOptions | string): DevHostEntry | undefined;
|
|
85
|
-
|
|
86
78
|
type RelayProtocol = "http" | "https";
|
|
87
79
|
type RelayAccessMode = "private" | "public";
|
|
88
80
|
type RelayLocalTarget = {
|
|
@@ -169,6 +161,80 @@ declare function redactRelayHeaders(headers: Record<string, string | string[] |
|
|
|
169
161
|
declare function redactRelayLogUrl(input: string): string;
|
|
170
162
|
declare function renderRelayOfflineResponse(): RelayOfflineResponse;
|
|
171
163
|
|
|
164
|
+
type DevHostEntry = {
|
|
165
|
+
host: string;
|
|
166
|
+
port: number;
|
|
167
|
+
target: string;
|
|
168
|
+
};
|
|
169
|
+
declare const LOCALGHOST_GHOST_TUNNEL_FILE = ".ghosttunnel";
|
|
170
|
+
type ReadGhostTunnelOptions = ReadDevHostsOptions;
|
|
171
|
+
type ReadDevHostsOptions = {
|
|
172
|
+
cwd?: string;
|
|
173
|
+
fileName?: string;
|
|
174
|
+
configFiles?: string[];
|
|
175
|
+
configPattern?: string | RegExp;
|
|
176
|
+
};
|
|
177
|
+
declare function resolveGhostTunnelPath(options?: ReadGhostTunnelOptions | string): {
|
|
178
|
+
path: string;
|
|
179
|
+
fileName: string;
|
|
180
|
+
exists: boolean;
|
|
181
|
+
searchedFiles: string[];
|
|
182
|
+
};
|
|
183
|
+
declare function getGhostTunnelPath(options?: ReadGhostTunnelOptions | string): string;
|
|
184
|
+
declare function readGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
|
|
185
|
+
declare function listGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
|
|
186
|
+
declare function findGhostTunnelEntry(host: string, options?: ReadGhostTunnelOptions | string): DevHostEntry | undefined;
|
|
187
|
+
|
|
188
|
+
declare const DEFAULT_GHOST_TUNNEL_TRANSPORT_QUERY_PARAM = "__localghost";
|
|
189
|
+
declare const DEFAULT_GHOST_TUNNEL_IP_TRANSPORT_TTL_SECONDS: number;
|
|
190
|
+
type GhostTunnelIpTransportClaim = {
|
|
191
|
+
kind: "ip";
|
|
192
|
+
host: string;
|
|
193
|
+
address: string;
|
|
194
|
+
protocol: RelayProtocol;
|
|
195
|
+
expiresAt: string;
|
|
196
|
+
};
|
|
197
|
+
type SignedGhostTunnelIpTransportClaim = {
|
|
198
|
+
payload: GhostTunnelIpTransportClaim;
|
|
199
|
+
token: string;
|
|
200
|
+
};
|
|
201
|
+
type ConstructGhostTunnelIpUrlInput = ({
|
|
202
|
+
url: string;
|
|
203
|
+
} | ConstructGhostTunnelUrlInput) & {
|
|
204
|
+
address: string;
|
|
205
|
+
signingSecret: string;
|
|
206
|
+
expiresAt?: string;
|
|
207
|
+
ttlSeconds?: number;
|
|
208
|
+
queryParam?: string;
|
|
209
|
+
targetProtocol?: RelayProtocol;
|
|
210
|
+
allowPrivateNetworkAddress?: boolean;
|
|
211
|
+
};
|
|
212
|
+
type ResolveGhostTunnelIpRedirectInput = {
|
|
213
|
+
requestUrl: string;
|
|
214
|
+
host: string;
|
|
215
|
+
entryPort: number;
|
|
216
|
+
signingSecret: string;
|
|
217
|
+
transport?: GhostTunnelTransportOptions | GhostTunnelTransportConfig;
|
|
218
|
+
queryParam?: string;
|
|
219
|
+
now?: Date;
|
|
220
|
+
};
|
|
221
|
+
type ResolvedGhostTunnelIpRedirect = {
|
|
222
|
+
claim: GhostTunnelIpTransportClaim;
|
|
223
|
+
queryParam: string;
|
|
224
|
+
target: Required<RelayLocalTarget>;
|
|
225
|
+
url: string;
|
|
226
|
+
};
|
|
227
|
+
declare function signGhostTunnelIpTransportClaim(claim: GhostTunnelIpTransportClaim, signingSecret: string, options?: {
|
|
228
|
+
allowPrivateNetworkAddress?: boolean;
|
|
229
|
+
}): SignedGhostTunnelIpTransportClaim;
|
|
230
|
+
declare function verifyGhostTunnelIpTransportClaim(token: string, signingSecret: string, options: {
|
|
231
|
+
host: string;
|
|
232
|
+
allowPrivateNetworkAddress?: boolean;
|
|
233
|
+
now?: Date;
|
|
234
|
+
}): GhostTunnelIpTransportClaim;
|
|
235
|
+
declare function constructGhostTunnelIpUrl(input: ConstructGhostTunnelIpUrlInput): string;
|
|
236
|
+
declare function resolveGhostTunnelIpRedirect(input: ResolveGhostTunnelIpRedirectInput): ResolvedGhostTunnelIpRedirect;
|
|
237
|
+
|
|
172
238
|
declare const DEFAULT_GHOST_TUNNEL_RESPONSE_TTL_SECONDS = 60;
|
|
173
239
|
type GhostTunnelStoreEnv = Record<string, string | undefined>;
|
|
174
240
|
type GhostTunnelQueuedRequest = {
|
|
@@ -270,55 +336,59 @@ type ServeGhostTunnelLocalRequestInput = {
|
|
|
270
336
|
declare function serveGhostTunnelLocalRequest(input: ServeGhostTunnelLocalRequestInput): Promise<GhostTunnelQueuedResponse>;
|
|
271
337
|
declare function startGhostTunnelAgent(options: GhostTunnelAgentOptions): GhostTunnelAgent;
|
|
272
338
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
type GhostTunnelIpTransportClaim = {
|
|
276
|
-
kind: "ip";
|
|
339
|
+
type ResolveGhostTunnelRequestInput$1 = {
|
|
340
|
+
cwd?: string;
|
|
277
341
|
host: string;
|
|
278
|
-
|
|
279
|
-
protocol:
|
|
280
|
-
|
|
342
|
+
domain: string;
|
|
343
|
+
protocol: "http" | "https";
|
|
344
|
+
authenticated?: boolean;
|
|
345
|
+
ghostTunnel?: GhostTunnelOptions | GhostTunnelConfig;
|
|
346
|
+
resolveGhostTunnel?: (input: {
|
|
347
|
+
domain: string;
|
|
348
|
+
cwd?: string;
|
|
349
|
+
}) => GhostTunnelOptions | GhostTunnelConfig | Promise<GhostTunnelOptions | GhostTunnelConfig>;
|
|
350
|
+
ghostTunnelFile?: string;
|
|
281
351
|
};
|
|
282
|
-
type
|
|
283
|
-
|
|
284
|
-
|
|
352
|
+
type ResolvedGhostTunnelRequest = {
|
|
353
|
+
route: GhostTunnelRoute;
|
|
354
|
+
ghostTunnel: GhostTunnelConfig;
|
|
355
|
+
entry?: DevHostEntry;
|
|
356
|
+
target?: Required<RelayLocalTarget>;
|
|
357
|
+
ghostTunnelPath?: string;
|
|
285
358
|
};
|
|
286
|
-
type
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
signingSecret: string;
|
|
291
|
-
expiresAt?: string;
|
|
292
|
-
ttlSeconds?: number;
|
|
293
|
-
queryParam?: string;
|
|
294
|
-
targetProtocol?: RelayProtocol;
|
|
295
|
-
allowPrivateNetworkAddress?: boolean;
|
|
359
|
+
type GhostTunnelHttpResponse = {
|
|
360
|
+
status: number;
|
|
361
|
+
headers: Record<string, string>;
|
|
362
|
+
body: string;
|
|
296
363
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
364
|
+
declare function renderGhostTunnelRouteMissingResponse(resolved: Pick<ResolvedGhostTunnelRequest, "route">): GhostTunnelHttpResponse;
|
|
365
|
+
declare function renderGhostTunnelRelayOfflineResponse(resolved: Pick<ResolvedGhostTunnelRequest, "route"> & Partial<Pick<ResolvedGhostTunnelRequest, "entry">>): GhostTunnelHttpResponse;
|
|
366
|
+
|
|
367
|
+
type VercelGhostTunnelRequestLike = {
|
|
368
|
+
headers: Record<string, string | string[] | undefined>;
|
|
369
|
+
url?: string;
|
|
370
|
+
method?: string;
|
|
371
|
+
[Symbol.asyncIterator]?: () => AsyncIterator<Buffer | Uint8Array | string>;
|
|
305
372
|
};
|
|
306
|
-
type
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
373
|
+
type VercelGhostTunnelResponseLike = {
|
|
374
|
+
setHeader(name: string, value: string): void;
|
|
375
|
+
end(body: string): void;
|
|
376
|
+
statusCode: number;
|
|
377
|
+
};
|
|
378
|
+
type CreateVercelGhostTunnelHandlerOptions$1 = {
|
|
379
|
+
cwd?: string;
|
|
380
|
+
domain: string;
|
|
381
|
+
ghostTunnel?: GhostTunnelOptions | GhostTunnelConfig;
|
|
382
|
+
resolveGhostTunnel?: (input: {
|
|
383
|
+
domain: string;
|
|
384
|
+
cwd?: string;
|
|
385
|
+
}) => GhostTunnelOptions | GhostTunnelConfig | Promise<GhostTunnelOptions | GhostTunnelConfig>;
|
|
386
|
+
ghostTunnelFile?: string;
|
|
387
|
+
ipSigningSecret?: string;
|
|
388
|
+
tunnelStore?: GhostTunnelStore;
|
|
389
|
+
tunnelEnv?: GhostTunnelStoreEnv;
|
|
390
|
+
authenticated?: boolean | ((request: VercelGhostTunnelRequestLike) => boolean | Promise<boolean>);
|
|
311
391
|
};
|
|
312
|
-
declare function signGhostTunnelIpTransportClaim(claim: GhostTunnelIpTransportClaim, signingSecret: string, options?: {
|
|
313
|
-
allowPrivateNetworkAddress?: boolean;
|
|
314
|
-
}): SignedGhostTunnelIpTransportClaim;
|
|
315
|
-
declare function verifyGhostTunnelIpTransportClaim(token: string, signingSecret: string, options: {
|
|
316
|
-
host: string;
|
|
317
|
-
allowPrivateNetworkAddress?: boolean;
|
|
318
|
-
now?: Date;
|
|
319
|
-
}): GhostTunnelIpTransportClaim;
|
|
320
|
-
declare function constructGhostTunnelIpUrl(input: ConstructGhostTunnelIpUrlInput): string;
|
|
321
|
-
declare function resolveGhostTunnelIpRedirect(input: ResolveGhostTunnelIpRedirectInput): ResolvedGhostTunnelIpRedirect;
|
|
322
392
|
|
|
323
393
|
type CaddyModeOptions = {
|
|
324
394
|
https?: boolean;
|
|
@@ -333,8 +403,8 @@ type CaddyProcessStopResult = {
|
|
|
333
403
|
};
|
|
334
404
|
type CaddyProcessKiller = (pid: number, signal: NodeJS.Signals) => void;
|
|
335
405
|
declare function getCaddyfilePath(cwd?: string): string;
|
|
336
|
-
declare function renderCaddyfile(entries: DevHostEntry[], options?: CaddyModeOptions): string;
|
|
337
|
-
declare function writeCaddyfile(entries: DevHostEntry[], cwd?: string, options?: CaddyModeOptions): Promise<string>;
|
|
406
|
+
declare function renderCaddyfile(entries: DevHostEntry$1[], options?: CaddyModeOptions): string;
|
|
407
|
+
declare function writeCaddyfile(entries: DevHostEntry$1[], cwd?: string, options?: CaddyModeOptions): Promise<string>;
|
|
338
408
|
declare function validateCaddyfile(path: string): Promise<void>;
|
|
339
409
|
declare function runCaddy(path: string): Promise<void>;
|
|
340
410
|
declare function startCaddy(path: string): execa.ResultPromise<{
|
|
@@ -345,31 +415,14 @@ declare function startCaddy(path: string): execa.ResultPromise<{
|
|
|
345
415
|
declare function stopCaddyProcesses(pids: Iterable<number>, killProcess?: CaddyProcessKiller): CaddyProcessStopResult;
|
|
346
416
|
declare function trustCaddy(path: string): Promise<void>;
|
|
347
417
|
|
|
348
|
-
type ResolveGhostTunnelRequestInput = {
|
|
349
|
-
cwd?: string;
|
|
350
|
-
host: string;
|
|
351
|
-
domain: string;
|
|
352
|
-
protocol: "http" | "https";
|
|
353
|
-
authenticated?: boolean;
|
|
418
|
+
type ResolveGhostTunnelRequestInput = Omit<ResolveGhostTunnelRequestInput$1, "ghostTunnel" | "resolveGhostTunnel"> & {
|
|
354
419
|
localghostConfig?: string | false;
|
|
355
|
-
ghostTunnelFile?: string;
|
|
356
420
|
};
|
|
357
|
-
type
|
|
358
|
-
route: GhostTunnelRoute;
|
|
359
|
-
ghostTunnel: GhostTunnelConfig;
|
|
360
|
-
entry?: DevHostEntry;
|
|
361
|
-
target?: Required<RelayLocalTarget>;
|
|
421
|
+
type ResolvedLocalghostTunnelRequest = ResolvedGhostTunnelRequest & {
|
|
362
422
|
projectConfigPath?: string;
|
|
363
|
-
ghostTunnelPath?: string;
|
|
364
|
-
};
|
|
365
|
-
type GhostTunnelHttpResponse = {
|
|
366
|
-
status: number;
|
|
367
|
-
headers: Record<string, string>;
|
|
368
|
-
body: string;
|
|
369
423
|
};
|
|
370
|
-
|
|
371
|
-
declare function
|
|
372
|
-
declare function renderGhostTunnelRelayOfflineResponse(resolved: Pick<ResolvedGhostTunnelRequest, "route"> & Partial<Pick<ResolvedGhostTunnelRequest, "entry">>): GhostTunnelHttpResponse;
|
|
424
|
+
|
|
425
|
+
declare function resolveGhostTunnelRequest(input: ResolveGhostTunnelRequestInput): Promise<ResolvedLocalghostTunnelRequest>;
|
|
373
426
|
|
|
374
427
|
type LocalghostPackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
|
375
428
|
type DetectedDevCommand = {
|
|
@@ -431,11 +484,11 @@ type LocalghostContextOptions = {
|
|
|
431
484
|
type LocalghostContext = {
|
|
432
485
|
cwd: string;
|
|
433
486
|
projectName: string;
|
|
434
|
-
readOptions: ReadDevHostsOptions;
|
|
487
|
+
readOptions: ReadDevHostsOptions$1;
|
|
435
488
|
configPath: string;
|
|
436
489
|
configFileName: string;
|
|
437
|
-
configEntries: DevHostEntry[];
|
|
438
|
-
entries: DevHostEntry[];
|
|
490
|
+
configEntries: DevHostEntry$1[];
|
|
491
|
+
entries: DevHostEntry$1[];
|
|
439
492
|
hosts: string[];
|
|
440
493
|
requestedPort: number;
|
|
441
494
|
port: number;
|
|
@@ -512,10 +565,10 @@ type RemoveSystemHostsResult = UpdateSystemHostsResult & {
|
|
|
512
565
|
removed: boolean;
|
|
513
566
|
};
|
|
514
567
|
declare function getSystemHostsPath(env?: NodeJS.ProcessEnv): string;
|
|
515
|
-
declare function renderHostsBlock(projectName: string, entries: DevHostEntry[]): string;
|
|
568
|
+
declare function renderHostsBlock(projectName: string, entries: DevHostEntry$1[]): string;
|
|
516
569
|
declare function upsertManagedBlock(existing: string, projectName: string, block: string): string;
|
|
517
570
|
declare function removeManagedBlock(existing: string, projectName: string): string;
|
|
518
|
-
declare function updateSystemHosts(projectName: string, entries: DevHostEntry[]): Promise<UpdateSystemHostsResult>;
|
|
571
|
+
declare function updateSystemHosts(projectName: string, entries: DevHostEntry$1[]): Promise<UpdateSystemHostsResult>;
|
|
519
572
|
declare function removeSystemHosts(projectName: string): Promise<RemoveSystemHostsResult>;
|
|
520
573
|
|
|
521
574
|
type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
|
|
@@ -607,6 +660,11 @@ type LocalghostRegistry = {
|
|
|
607
660
|
prune(): Promise<{
|
|
608
661
|
removedLeases: number;
|
|
609
662
|
}>;
|
|
663
|
+
pruneTestSessions(): Promise<{
|
|
664
|
+
removedLeases: number;
|
|
665
|
+
removedAllocations: number;
|
|
666
|
+
}>;
|
|
667
|
+
reset(): Promise<void>;
|
|
610
668
|
};
|
|
611
669
|
declare function getLocalghostRegistryRoot(env?: NodeJS.ProcessEnv): string;
|
|
612
670
|
declare function canonicalizeLocalghostProjectCwd(cwd?: string): string;
|
|
@@ -658,8 +716,8 @@ type GhostTunnelFormatOptions = {
|
|
|
658
716
|
label?: "configured" | "expected" | "ready" | "running";
|
|
659
717
|
verbose?: boolean;
|
|
660
718
|
};
|
|
661
|
-
declare function getDomainRoutes(entries: DevHostEntry[], options?: DomainRouteOptions): DomainRoute[];
|
|
662
|
-
declare function formatDomainRoutes(entries: DevHostEntry[], options?: DomainRouteOptions): string;
|
|
719
|
+
declare function getDomainRoutes(entries: DevHostEntry$1[], options?: DomainRouteOptions): DomainRoute[];
|
|
720
|
+
declare function formatDomainRoutes(entries: DevHostEntry$1[], options?: DomainRouteOptions): string;
|
|
663
721
|
declare function formatGhostTunnel(config: GhostTunnelConfig, options?: GhostTunnelFormatOptions): string | null;
|
|
664
722
|
|
|
665
723
|
declare const LOCALGHOST_STATE_FILE = "ops/local/localghost-state.json";
|
|
@@ -679,7 +737,7 @@ type LocalghostState = {
|
|
|
679
737
|
caddyHttps?: boolean;
|
|
680
738
|
caddyTrustedAt?: string;
|
|
681
739
|
caddyTrustPromptedAt?: string;
|
|
682
|
-
entries?: DevHostEntry[];
|
|
740
|
+
entries?: DevHostEntry$1[];
|
|
683
741
|
};
|
|
684
742
|
type WriteLocalghostStateInput = Omit<LocalghostState, "version" | "updatedAt">;
|
|
685
743
|
declare function getLocalghostStatePath(cwd?: string): string;
|
|
@@ -687,31 +745,13 @@ declare function readLocalghostState(cwd?: string): LocalghostState | null;
|
|
|
687
745
|
declare function writeLocalghostState(cwd: string, state: WriteLocalghostStateInput): string;
|
|
688
746
|
declare function patchLocalghostState(cwd: string, patch: Partial<WriteLocalghostStateInput>): string | null;
|
|
689
747
|
|
|
690
|
-
type
|
|
691
|
-
headers: Record<string, string | string[] | undefined>;
|
|
692
|
-
url?: string;
|
|
693
|
-
method?: string;
|
|
694
|
-
[Symbol.asyncIterator]?: () => AsyncIterator<Buffer | Uint8Array | string>;
|
|
695
|
-
};
|
|
696
|
-
type VercelGhostTunnelResponseLike = {
|
|
697
|
-
setHeader(name: string, value: string): void;
|
|
698
|
-
end(body: string): void;
|
|
699
|
-
statusCode: number;
|
|
700
|
-
};
|
|
701
|
-
type CreateVercelGhostTunnelHandlerOptions = {
|
|
702
|
-
cwd?: string;
|
|
703
|
-
domain: string;
|
|
748
|
+
type CreateVercelGhostTunnelHandlerOptions = Omit<CreateVercelGhostTunnelHandlerOptions$1, "resolveGhostTunnel"> & {
|
|
704
749
|
localghostConfig?: string | false;
|
|
705
|
-
ghostTunnelFile?: string;
|
|
706
|
-
ipSigningSecret?: string;
|
|
707
|
-
tunnelStore?: GhostTunnelStore;
|
|
708
|
-
tunnelEnv?: GhostTunnelStoreEnv;
|
|
709
|
-
authenticated?: boolean | ((request: VercelGhostTunnelRequestLike) => boolean | Promise<boolean>);
|
|
710
750
|
};
|
|
711
751
|
declare function createVercelGhostTunnelHandler(options: CreateVercelGhostTunnelHandlerOptions): (request: VercelGhostTunnelRequestLike, response: VercelGhostTunnelResponseLike) => Promise<void>;
|
|
712
752
|
|
|
713
753
|
declare const LOCALGHOST_PACKAGE_NAME = "@hamedb89/localghost";
|
|
714
|
-
declare const LOCALGHOST_VERSION = "0.
|
|
754
|
+
declare const LOCALGHOST_VERSION = "0.6.2";
|
|
715
755
|
declare const UPDATE_CHECK_CACHE_TTL_MS: number;
|
|
716
756
|
declare const UPDATE_CHECK_NOTIFY_TTL_MS: number;
|
|
717
757
|
declare const UPDATE_CHECK_TIMEOUT_MS = 900;
|
|
@@ -748,4 +788,4 @@ declare function maybeNotifyAboutUpdate(options?: {
|
|
|
748
788
|
disabled?: boolean;
|
|
749
789
|
}): Promise<void>;
|
|
750
790
|
|
|
751
|
-
export { type AcquireLocalghostPortOptions, type ActiveRelayRoute, type CaddyModeOptions, type CaddyProcessKiller, type CaddyProcessStopResult, ConfigPattern, type ConstructGhostTunnelIpUrlInput, ConstructGhostTunnelUrlInput, type CreateVercelGhostTunnelHandlerOptions, DEFAULT_GHOST_TUNNEL_IP_TRANSPORT_TTL_SECONDS, DEFAULT_GHOST_TUNNEL_RESPONSE_TTL_SECONDS, DEFAULT_GHOST_TUNNEL_TRANSPORT_QUERY_PARAM, DEFAULT_RELAY_ALLOWED_TARGET_HOSTS, DEFAULT_RELAY_BLOCKED_PORTS, DEFAULT_RELAY_LIMITS, DEFAULT_RELAY_TARGET_POLICY, type DetectedDevCommand, type DetectedDevService, DevHostEntry, type DoctorOptions, type DoctorResult, type DomainRoute, type DomainRouteOptions, type FindAvailablePortOptions, type GhostTunnelAgent, type GhostTunnelAgentOptions, GhostTunnelConfig, type GhostTunnelHttpResponse, type GhostTunnelIpTransportClaim, GhostTunnelOptions, type GhostTunnelQueuedRequest, type GhostTunnelQueuedResponse, GhostTunnelRoute, type GhostTunnelRouteHeartbeat, type GhostTunnelStore, type GhostTunnelStoreEnv, GhostTunnelTransportConfig, GhostTunnelTransportOptions, type InitOptions, type InitResult, LOCALGHOST_ACTIVITY_VERSION, LOCALGHOST_AGENT_GUIDE, LOCALGHOST_GHOST_TUNNEL_FILE, LOCALGHOST_PACKAGE_NAME, LOCALGHOST_REGISTRY_FILE, LOCALGHOST_REGISTRY_LOCK_FILE, LOCALGHOST_STATE_FILE, LOCALGHOST_VERSION, type LocalghostActivity, type LocalghostContext, type LocalghostContextOptions, type LocalghostEnvironment, type LocalghostLease, type LocalghostPackageManager, type LocalghostProjectConfig, type LocalghostProjectConfigResult, type LocalghostRegistry, type LocalghostRegistryData, type LocalghostRegistryEntry, type LocalghostRegistryOptions, type LocalghostRunMode, type LocalghostRunRecord, type LocalghostServiceOptions, type LocalghostSetupRecord, type LocalghostState, type LocalghostStateAction, type LocalghostTestSession, type LocalghostTestSessionOptions, type PackageManager, type PortAvailabilityCheck, ReadDevHostsOptions, type ReadGhostTunnelOptions, type RedisGhostTunnelEnvResolution, type RedisGhostTunnelStoreOptions, type RegisterLocalghostRunInput, type RegisterLocalghostSetupInput, type RelayAccessMode, type RelayLimits, type RelayLocalTarget, type RelayOfflineResponse, type RelayProtocol, type RelayRouteClaim, type RelayRouteRegistrationInput, type RelayTargetPolicy, type RemoveSystemHostsResult, type ResolveGhostTunnelIpRedirectInput, type ResolveGhostTunnelRequestInput,
|
|
791
|
+
export { type AcquireLocalghostPortOptions, type ActiveRelayRoute, type CaddyModeOptions, type CaddyProcessKiller, type CaddyProcessStopResult, ConfigPattern, type ConstructGhostTunnelIpUrlInput, ConstructGhostTunnelUrlInput, type CreateVercelGhostTunnelHandlerOptions, DEFAULT_GHOST_TUNNEL_IP_TRANSPORT_TTL_SECONDS, DEFAULT_GHOST_TUNNEL_RESPONSE_TTL_SECONDS, DEFAULT_GHOST_TUNNEL_TRANSPORT_QUERY_PARAM, DEFAULT_RELAY_ALLOWED_TARGET_HOSTS, DEFAULT_RELAY_BLOCKED_PORTS, DEFAULT_RELAY_LIMITS, DEFAULT_RELAY_TARGET_POLICY, type DetectedDevCommand, type DetectedDevService, DevHostEntry$1 as DevHostEntry, type DoctorOptions, type DoctorResult, type DomainRoute, type DomainRouteOptions, type FindAvailablePortOptions, type GhostTunnelAgent, type GhostTunnelAgentOptions, GhostTunnelConfig, type GhostTunnelHttpResponse, type GhostTunnelIpTransportClaim, GhostTunnelOptions, type GhostTunnelQueuedRequest, type GhostTunnelQueuedResponse, GhostTunnelRoute, type GhostTunnelRouteHeartbeat, type GhostTunnelStore, type GhostTunnelStoreEnv, GhostTunnelTransportConfig, GhostTunnelTransportOptions, type InitOptions, type InitResult, LOCALGHOST_ACTIVITY_VERSION, LOCALGHOST_AGENT_GUIDE, LOCALGHOST_GHOST_TUNNEL_FILE, LOCALGHOST_PACKAGE_NAME, LOCALGHOST_REGISTRY_FILE, LOCALGHOST_REGISTRY_LOCK_FILE, LOCALGHOST_STATE_FILE, LOCALGHOST_VERSION, type LocalghostActivity, type LocalghostContext, type LocalghostContextOptions, type LocalghostEnvironment, type LocalghostLease, type LocalghostPackageManager, type LocalghostProjectConfig, type LocalghostProjectConfigResult, type LocalghostRegistry, type LocalghostRegistryData, type LocalghostRegistryEntry, type LocalghostRegistryOptions, type LocalghostRunMode, type LocalghostRunRecord, type LocalghostServiceOptions, type LocalghostSetupRecord, type LocalghostState, type LocalghostStateAction, type LocalghostTestSession, type LocalghostTestSessionOptions, type PackageManager, type PortAvailabilityCheck, ReadDevHostsOptions$1 as ReadDevHostsOptions, type ReadGhostTunnelOptions, type RedisGhostTunnelEnvResolution, type RedisGhostTunnelStoreOptions, type RegisterLocalghostRunInput, type RegisterLocalghostSetupInput, type RelayAccessMode, type RelayLimits, type RelayLocalTarget, type RelayOfflineResponse, type RelayProtocol, type RelayRouteClaim, type RelayRouteRegistrationInput, type RelayTargetPolicy, type RemoveSystemHostsResult, type ResolveGhostTunnelIpRedirectInput, type ResolveGhostTunnelRequestInput, type ResolvedGhostTunnelIpRedirect, type ResolvedLocalghostTunnelRequest as ResolvedGhostTunnelRequest, type ServeGhostTunnelLocalRequestInput, type SignedGhostTunnelIpTransportClaim, type SignedRelayRouteClaim, UPDATE_CHECK_CACHE_TTL_MS, UPDATE_CHECK_NOTIFY_TTL_MS, UPDATE_CHECK_TIMEOUT_MS, type UpdateCheckCache, type UpdateCheckResult, type UpdateSystemHostsResult, type VercelGhostTunnelRequestLike, type VercelGhostTunnelResponseLike, type WriteLocalghostStateInput, assertExactRelayHost, assertLocalDevelopment, assertRelayLocalTarget, authenticateRelayAgentToken, canonicalizeLocalghostProjectCwd, checkCaddy, checkForUpdate, compareVersions, constructGhostTunnelIpUrl, createGhostTunnelQueuedRequest, createGhostTunnelRouteHeartbeat, createLocalghostRegistry, createLocalghostTestSession, createMemoryGhostTunnelStore, createRedisGhostTunnelStore, createRedisGhostTunnelStoreFromEnv, createRelayRouteRegistration, createVercelGhostTunnelHandler, decodeGhostTunnelBody, defineLocalghostConfig, detectDevCommand, detectDevPackageManager, detectDevServices, detectPackageManager, encodeGhostTunnelBody, findAvailablePort, findGhostTunnelEntry, formatDetectedDevCommand, formatDetectedDevServices, formatDomainRoutes, formatGhostTunnel, formatLocalghostAgentGuide, formatUpdateMessage, getCaddyfilePath, getDomainRoutes, getGhostTunnelPath, getLocalghostActivityPath, getLocalghostRegistryRoot, getLocalghostStatePath, getProductionEnvKeys, getProductionReason, getSystemHostsPath, getUpdateCheckCachePath, initLocalghost, isNewerVersion, isPortAvailable, isProcessRunning, isProductionLike, isRelayRouteActive, isUpdateCheckDisabled, listGhostTunnelEntries, listLocalghostRuns, listLocalghostSetups, markUpdateNotified, maybeNotifyAboutUpdate, packageAddCommand, packageRunCommand, patchLocalghostState, pruneLocalghostActivity, readGhostTunnelEntries, readLocalghostActivity, readLocalghostProjectConfig, readLocalghostState, redactRelayHeaders, redactRelayLogUrl, registerLocalghostRun, registerLocalghostSetup, removeManagedBlock, removeSystemHosts, renderCaddyfile, renderCompactLocalghostBanner, renderGhostTunnelRelayOfflineResponse, renderGhostTunnelRouteMissingResponse, renderHostsBlock, renderLocalghostBanner, renderRelayOfflineResponse, resolveGhostTunnelIpRedirect, resolveGhostTunnelPath, resolveGhostTunnelRequest, resolveLocalghostContext, resolveRedisGhostTunnelEnv, runCaddy, runDoctor, serveGhostTunnelLocalRequest, shouldNotifyAboutUpdate, signGhostTunnelIpTransportClaim, signRelayRouteClaim, signalManagedProcess, signalManagedProcessPid, startCaddy, startGhostTunnelAgent, stopCaddyProcesses, stripRelayForwardHeaders, trustCaddy, unregisterLocalghostRun, unregisterLocalghostSetup, updateSystemHosts, upsertManagedBlock, validateCaddyfile, verifyGhostTunnelIpTransportClaim, verifyRelayRouteClaim, writeCaddyfile, writeLocalghostActivity, writeLocalghostState };
|