@hamedb89/localghost 0.1.10 → 0.1.13

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
@@ -1,5 +1,5 @@
1
- import { D as DevHostEntry, R as ReadDevHostsOptions, a as GhostTunnelConfig, C as ConfigPattern, G as GhostTunnelOptions } from './tunnel-DzfLXZ8O.js';
2
- export { b as ConstructGhostTunnelUrlInput, c as GhostTunnelDisplayDefaults, d as GhostTunnelDomainOptions, e as GhostTunnelMode, f as GhostTunnelNamespaceConfig, g as GhostTunnelNamespaceOptions, h as GhostTunnelNamespaceTag, i as GhostTunnelNamespaceValues, j as GhostTunnelPreviewOptions, k as GhostTunnelRoute, L as LOCALGHOST_CONFIG_FILE, l as ResolvedDevHostsPath, m as assertSecureGhostTunnelRequest, n as constructGhostTunnelHost, o as constructGhostTunnelURL, p as constructGhostTunnelUrl, q as findLocalMdnsHosts, r as getConfigFileCandidates, s as getDevHostsPath, t as getGhostTunnelDefaultDisplayUrl, u as getGhostTunnelDisplayUrl, v as getGhostTunnelDisplayUrls, w as getGhostTunnelEntryHost, x as getGhostTunnelPreviewUrl, y as getGhostTunnelWildcardHost, z as getProjectName, A as parseDevHosts, B as parseGhostTunnelHost, E as readDevHosts, F as resolveDevHostsPath, H as resolveGhostTunnelConfig, I as sanitizeProjectName } from './tunnel-DzfLXZ8O.js';
1
+ import { D as DevHostEntry, R as ReadDevHostsOptions, a as ResolvedDevHostsPath, b as ConstructGhostTunnelUrlInput, c as GhostTunnelTransportOptions, d as GhostTunnelTransportConfig, e as GhostTunnelRoute, f as GhostTunnelConfig, C as ConfigPattern, G as GhostTunnelOptions } from './tunnel-BA52DD9e.js';
2
+ export { g as GhostTunnelAdapterOptions, h as GhostTunnelAdapterProvider, i as GhostTunnelAdapterStrategy, j as GhostTunnelAdapterTransport, k as GhostTunnelDisplayDefaults, l as GhostTunnelDomainOptions, m as GhostTunnelMode, n as GhostTunnelNamespaceConfig, o as GhostTunnelNamespaceOptions, p as GhostTunnelNamespaceTag, q as GhostTunnelNamespaceValues, r as GhostTunnelPreviewOptions, s as GhostTunnelTransportKind, t as GhostTunnelTunnelStoreEnv, u as GhostTunnelTunnelStoreOptions, v as GhostTunnelTunnelStoreProvider, L as LOCALGHOST_CONFIG_FILE, 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-BA52DD9e.js';
3
3
  import * as execa from 'execa';
4
4
 
5
5
  declare const LOCALGHOST_ACTIVITY_VERSION = 1;
@@ -67,6 +67,254 @@ declare function unregisterLocalghostSetup(options: {
67
67
  configPath?: string;
68
68
  }, path?: string): void;
69
69
 
70
+ declare function renderLocalghostBanner(): string;
71
+ declare function renderCompactLocalghostBanner(): string;
72
+
73
+ declare const LOCALGHOST_GHOST_TUNNEL_FILE = ".ghosttunnel";
74
+ type ReadGhostTunnelOptions = ReadDevHostsOptions;
75
+ declare function resolveGhostTunnelPath(options?: ReadGhostTunnelOptions | string): ResolvedDevHostsPath;
76
+ declare function getGhostTunnelPath(options?: ReadGhostTunnelOptions | string): string;
77
+ declare function readGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
78
+ declare function listGhostTunnelEntries(options?: ReadGhostTunnelOptions | string): DevHostEntry[];
79
+ declare function findGhostTunnelEntry(host: string, options?: ReadGhostTunnelOptions | string): DevHostEntry | undefined;
80
+
81
+ type RelayProtocol = "http" | "https";
82
+ type RelayAccessMode = "private" | "public";
83
+ type RelayLocalTarget = {
84
+ protocol?: RelayProtocol;
85
+ host: string;
86
+ port: number;
87
+ };
88
+ type RelayLimits = {
89
+ requestBodyBytes: number;
90
+ responseBytes: number;
91
+ timeoutMs: number;
92
+ maxConcurrentRequests: number;
93
+ perRouteRequestsPerMinute: number;
94
+ perIpRequestsPerMinute: number;
95
+ };
96
+ type RelayTargetPolicy = {
97
+ allowedHosts: string[];
98
+ blockedPorts: number[];
99
+ allowPrivateNetworkTargets: boolean;
100
+ };
101
+ type RelayRouteClaim = {
102
+ host: string;
103
+ scope: string;
104
+ expiresAt: string;
105
+ agentId: string;
106
+ };
107
+ type SignedRelayRouteClaim = {
108
+ payload: RelayRouteClaim;
109
+ token: string;
110
+ };
111
+ type RelayRouteRegistrationInput = {
112
+ authorizationHeader?: string | null;
113
+ agentToken: string;
114
+ claimToken: string;
115
+ signingSecret: string;
116
+ expectedScope: string;
117
+ target: RelayLocalTarget;
118
+ access?: RelayAccessMode;
119
+ publicMode?: boolean;
120
+ passwordProtected?: boolean;
121
+ authRequired?: boolean;
122
+ now?: Date;
123
+ targetPolicy?: Partial<RelayTargetPolicy>;
124
+ limits?: Partial<RelayLimits>;
125
+ };
126
+ type ActiveRelayRoute = {
127
+ host: string;
128
+ scope: string;
129
+ agentId: string;
130
+ expiresAt: string;
131
+ target: Required<RelayLocalTarget>;
132
+ access: RelayAccessMode;
133
+ passwordProtected: boolean;
134
+ authRequired: boolean;
135
+ limits: RelayLimits;
136
+ };
137
+ type RelayOfflineResponse = {
138
+ status: 503;
139
+ headers: Record<string, string>;
140
+ body: string;
141
+ };
142
+ declare const DEFAULT_RELAY_ALLOWED_TARGET_HOSTS: readonly ["localhost", "127.0.0.1", "::1"];
143
+ declare const DEFAULT_RELAY_BLOCKED_PORTS: readonly [22, 2375, 2376, 5432, 6379, 9200, 9229, 27017];
144
+ declare const DEFAULT_RELAY_LIMITS: RelayLimits;
145
+ declare const DEFAULT_RELAY_TARGET_POLICY: RelayTargetPolicy;
146
+ declare function assertExactRelayHost(host: string): string;
147
+ declare function assertRelayLocalTarget(target: RelayLocalTarget, policyInput?: Partial<RelayTargetPolicy>): Required<RelayLocalTarget>;
148
+ declare function authenticateRelayAgentToken(input: {
149
+ authorizationHeader?: string | null;
150
+ agentToken: string;
151
+ }): boolean;
152
+ declare function signRelayRouteClaim(claim: RelayRouteClaim, signingSecret: string): SignedRelayRouteClaim;
153
+ declare function verifyRelayRouteClaim(token: string, signingSecret: string, options: {
154
+ expectedScope: string;
155
+ now?: Date;
156
+ }): RelayRouteClaim;
157
+ declare function createRelayRouteRegistration(input: RelayRouteRegistrationInput): ActiveRelayRoute;
158
+ declare function isRelayRouteActive(route: ActiveRelayRoute, options: {
159
+ agentConnected: boolean;
160
+ now?: Date;
161
+ }): boolean;
162
+ declare function stripRelayForwardHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string | string[]>;
163
+ declare function redactRelayHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string | string[]>;
164
+ declare function redactRelayLogUrl(input: string): string;
165
+ declare function renderRelayOfflineResponse(): RelayOfflineResponse;
166
+
167
+ declare const DEFAULT_GHOST_TUNNEL_RESPONSE_TTL_SECONDS = 60;
168
+ type GhostTunnelStoreEnv = Record<string, string | undefined>;
169
+ type GhostTunnelQueuedRequest = {
170
+ id: string;
171
+ host: string;
172
+ method: string;
173
+ path: string;
174
+ headers: Record<string, string>;
175
+ createdAt: string;
176
+ expiresAt: string;
177
+ bodyBase64?: string;
178
+ };
179
+ type GhostTunnelQueuedResponse = {
180
+ id: string;
181
+ status: number;
182
+ headers: Record<string, string>;
183
+ createdAt: string;
184
+ bodyBase64?: string;
185
+ error?: string;
186
+ };
187
+ type GhostTunnelRouteHeartbeat = {
188
+ host: string;
189
+ agentId: string;
190
+ target: Required<RelayLocalTarget>;
191
+ updatedAt: string;
192
+ expiresAt: string;
193
+ };
194
+ type GhostTunnelStore = {
195
+ heartbeatRoute(route: GhostTunnelRouteHeartbeat, ttlSeconds: number): Promise<void>;
196
+ getRoute(host: string): Promise<GhostTunnelRouteHeartbeat | null>;
197
+ enqueueRequest(request: GhostTunnelQueuedRequest, ttlSeconds: number): Promise<void>;
198
+ claimRequest(host: string): Promise<GhostTunnelQueuedRequest | null>;
199
+ writeResponse(response: GhostTunnelQueuedResponse, ttlSeconds: number): Promise<void>;
200
+ readResponse(requestId: string): Promise<GhostTunnelQueuedResponse | null>;
201
+ cleanup(requestId: string): Promise<void>;
202
+ };
203
+ type RedisGhostTunnelStoreOptions = {
204
+ url: string;
205
+ token: string;
206
+ namespace?: string;
207
+ fetch?: typeof fetch;
208
+ };
209
+ type RedisGhostTunnelEnvResolution = {
210
+ url: string;
211
+ token: string;
212
+ source: "localghost" | "upstash" | "vercel-kv" | "redis";
213
+ };
214
+ declare function encodeGhostTunnelBody(value: Buffer | Uint8Array | string): string;
215
+ declare function decodeGhostTunnelBody(value: string | undefined): Buffer<ArrayBuffer> | undefined;
216
+ declare function createGhostTunnelQueuedRequest(input: {
217
+ host: string;
218
+ method: string;
219
+ path: string;
220
+ headers?: Record<string, string>;
221
+ body?: Buffer | Uint8Array | string;
222
+ ttlSeconds: number;
223
+ now?: Date;
224
+ }): GhostTunnelQueuedRequest;
225
+ declare function createGhostTunnelRouteHeartbeat(input: {
226
+ host: string;
227
+ agentId: string;
228
+ target: Required<RelayLocalTarget>;
229
+ ttlSeconds: number;
230
+ now?: Date;
231
+ }): GhostTunnelRouteHeartbeat;
232
+ declare function createMemoryGhostTunnelStore(): GhostTunnelStore;
233
+ declare function createRedisGhostTunnelStore(options: RedisGhostTunnelStoreOptions): GhostTunnelStore;
234
+ declare function resolveRedisGhostTunnelEnv(env?: GhostTunnelStoreEnv): RedisGhostTunnelEnvResolution;
235
+ declare function createRedisGhostTunnelStoreFromEnv(input?: {
236
+ env?: GhostTunnelStoreEnv;
237
+ namespace?: string;
238
+ fetch?: typeof fetch;
239
+ }): GhostTunnelStore;
240
+
241
+ type GhostTunnelAgentOptions = {
242
+ entries: DevHostEntry[];
243
+ store: GhostTunnelStore;
244
+ agentId?: string;
245
+ targetHost?: string;
246
+ routeTtlSeconds?: number;
247
+ requestTtlSeconds?: number;
248
+ pollIntervalMs?: number;
249
+ maxResponseBodyBytes?: number;
250
+ signal?: AbortSignal;
251
+ fetch?: typeof fetch;
252
+ log?: (message: string) => void;
253
+ };
254
+ type GhostTunnelAgent = {
255
+ agentId: string;
256
+ stop(): void;
257
+ done: Promise<void>;
258
+ };
259
+ type ServeGhostTunnelLocalRequestInput = {
260
+ request: GhostTunnelQueuedRequest;
261
+ target: Required<RelayLocalTarget>;
262
+ maxResponseBodyBytes: number;
263
+ fetch?: typeof fetch;
264
+ };
265
+ declare function serveGhostTunnelLocalRequest(input: ServeGhostTunnelLocalRequestInput): Promise<GhostTunnelQueuedResponse>;
266
+ declare function startGhostTunnelAgent(options: GhostTunnelAgentOptions): GhostTunnelAgent;
267
+
268
+ declare const DEFAULT_GHOST_TUNNEL_TRANSPORT_QUERY_PARAM = "__localghost";
269
+ declare const DEFAULT_GHOST_TUNNEL_IP_TRANSPORT_TTL_SECONDS: number;
270
+ type GhostTunnelIpTransportClaim = {
271
+ kind: "ip";
272
+ host: string;
273
+ address: string;
274
+ protocol: RelayProtocol;
275
+ expiresAt: string;
276
+ };
277
+ type SignedGhostTunnelIpTransportClaim = {
278
+ payload: GhostTunnelIpTransportClaim;
279
+ token: string;
280
+ };
281
+ type ConstructGhostTunnelIpUrlInput = ({
282
+ url: string;
283
+ } | ConstructGhostTunnelUrlInput) & {
284
+ address: string;
285
+ signingSecret: string;
286
+ expiresAt?: string;
287
+ ttlSeconds?: number;
288
+ queryParam?: string;
289
+ targetProtocol?: RelayProtocol;
290
+ allowPrivateNetworkAddress?: boolean;
291
+ };
292
+ type ResolveGhostTunnelIpRedirectInput = {
293
+ requestUrl: string;
294
+ host: string;
295
+ entryPort: number;
296
+ signingSecret: string;
297
+ transport?: GhostTunnelTransportOptions | GhostTunnelTransportConfig;
298
+ queryParam?: string;
299
+ now?: Date;
300
+ };
301
+ type ResolvedGhostTunnelIpRedirect = {
302
+ claim: GhostTunnelIpTransportClaim;
303
+ queryParam: string;
304
+ target: Required<RelayLocalTarget>;
305
+ url: string;
306
+ };
307
+ declare function signGhostTunnelIpTransportClaim(claim: GhostTunnelIpTransportClaim, signingSecret: string, options?: {
308
+ allowPrivateNetworkAddress?: boolean;
309
+ }): SignedGhostTunnelIpTransportClaim;
310
+ declare function verifyGhostTunnelIpTransportClaim(token: string, signingSecret: string, options: {
311
+ host: string;
312
+ allowPrivateNetworkAddress?: boolean;
313
+ now?: Date;
314
+ }): GhostTunnelIpTransportClaim;
315
+ declare function constructGhostTunnelIpUrl(input: ConstructGhostTunnelIpUrlInput): string;
316
+ declare function resolveGhostTunnelIpRedirect(input: ResolveGhostTunnelIpRedirectInput): ResolvedGhostTunnelIpRedirect;
317
+
70
318
  type CaddyModeOptions = {
71
319
  https?: boolean;
72
320
  };
@@ -77,10 +325,71 @@ declare function validateCaddyfile(path: string): Promise<void>;
77
325
  declare function runCaddy(path: string): Promise<void>;
78
326
  declare function startCaddy(path: string): execa.ResultPromise<{
79
327
  cwd: string;
80
- stdio: "inherit";
328
+ stdio: "inherit" | "pipe";
81
329
  }>;
82
330
  declare function trustCaddy(path: string): Promise<void>;
83
331
 
332
+ type ResolveGhostTunnelRequestInput = {
333
+ cwd?: string;
334
+ host: string;
335
+ domain: string;
336
+ protocol: "http" | "https";
337
+ authenticated?: boolean;
338
+ localghostConfig?: string | false;
339
+ ghostTunnelFile?: string;
340
+ };
341
+ type ResolvedGhostTunnelRequest = {
342
+ route: GhostTunnelRoute;
343
+ ghostTunnel: GhostTunnelConfig;
344
+ entry?: DevHostEntry;
345
+ target?: Required<RelayLocalTarget>;
346
+ projectConfigPath?: string;
347
+ ghostTunnelPath?: string;
348
+ };
349
+ type GhostTunnelHttpResponse = {
350
+ status: number;
351
+ headers: Record<string, string>;
352
+ body: string;
353
+ };
354
+ declare function resolveGhostTunnelRequest(input: ResolveGhostTunnelRequestInput): Promise<ResolvedGhostTunnelRequest>;
355
+ declare function renderGhostTunnelRouteMissingResponse(resolved: Pick<ResolvedGhostTunnelRequest, "route">): GhostTunnelHttpResponse;
356
+ declare function renderGhostTunnelRelayOfflineResponse(resolved: Pick<ResolvedGhostTunnelRequest, "route"> & Partial<Pick<ResolvedGhostTunnelRequest, "entry">>): GhostTunnelHttpResponse;
357
+
358
+ type LocalghostPackageManager = "npm" | "pnpm" | "yarn" | "bun";
359
+ type DetectedDevCommand = {
360
+ command: string[];
361
+ source: "config" | "script";
362
+ packageManager?: LocalghostPackageManager;
363
+ script?: string;
364
+ };
365
+ type LocalghostServiceOptions = {
366
+ name: string;
367
+ cwd: string;
368
+ host: string;
369
+ port: number;
370
+ command?: string[];
371
+ };
372
+ type DetectedDevService = {
373
+ name: string;
374
+ cwd: string;
375
+ relativeCwd: string;
376
+ host: string;
377
+ requestedPort: number;
378
+ command: string[];
379
+ commandSource: DetectedDevCommand["source"];
380
+ };
381
+ declare function detectDevPackageManager(cwd: string, packageManager: unknown): LocalghostPackageManager;
382
+ declare function detectDevCommand(options?: {
383
+ cwd?: string;
384
+ command?: string[];
385
+ }): DetectedDevCommand;
386
+ declare function formatDetectedDevCommand(detected: DetectedDevCommand): string;
387
+ declare function detectDevServices(options: {
388
+ cwd?: string;
389
+ services: LocalghostServiceOptions[];
390
+ }): DetectedDevService[];
391
+ declare function formatDetectedDevServices(services: DetectedDevService[]): string;
392
+
84
393
  type LocalghostContextOptions = {
85
394
  cwd?: string;
86
395
  project?: string;
@@ -93,6 +402,9 @@ type LocalghostContextOptions = {
93
402
  bindHost?: string | boolean;
94
403
  primaryHost?: string;
95
404
  dynamicPort?: boolean;
405
+ autoRepair?: boolean;
406
+ command?: string[];
407
+ services?: LocalghostServiceOptions[];
96
408
  wwwAlias?: boolean;
97
409
  ghostTunnel?: GhostTunnelOptions;
98
410
  };
@@ -108,6 +420,7 @@ type LocalghostContext = {
108
420
  requestedPort: number;
109
421
  port: number;
110
422
  dynamicPort: boolean;
423
+ autoRepair: boolean;
111
424
  bindHost: string | boolean;
112
425
  primaryHost: string;
113
426
  https: boolean;
@@ -152,14 +465,14 @@ type UpdateSystemHostsResult = {
152
465
  type RemoveSystemHostsResult = UpdateSystemHostsResult & {
153
466
  removed: boolean;
154
467
  };
155
- declare function getSystemHostsPath(): "C:\\Windows\\System32\\drivers\\etc\\hosts" | "/etc/hosts";
468
+ declare function getSystemHostsPath(env?: NodeJS.ProcessEnv): string;
156
469
  declare function renderHostsBlock(projectName: string, entries: DevHostEntry[]): string;
157
470
  declare function upsertManagedBlock(existing: string, projectName: string, block: string): string;
158
471
  declare function removeManagedBlock(existing: string, projectName: string): string;
159
472
  declare function updateSystemHosts(projectName: string, entries: DevHostEntry[]): Promise<UpdateSystemHostsResult>;
160
473
  declare function removeSystemHosts(projectName: string): Promise<RemoveSystemHostsResult>;
161
474
 
162
- type PackageManager = "npm" | "yarn" | "pnpm";
475
+ type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
163
476
  type InitOptions = {
164
477
  cwd?: string;
165
478
  host?: string;
@@ -191,92 +504,6 @@ type FindAvailablePortOptions = {
191
504
  declare function isPortAvailable(port: number, host?: string): Promise<boolean>;
192
505
  declare function findAvailablePort(startPort: number, options?: FindAvailablePortOptions): Promise<number>;
193
506
 
194
- type RelayProtocol = "http" | "https";
195
- type RelayAccessMode = "private" | "public";
196
- type RelayLocalTarget = {
197
- protocol?: RelayProtocol;
198
- host: string;
199
- port: number;
200
- };
201
- type RelayLimits = {
202
- requestBodyBytes: number;
203
- responseBytes: number;
204
- timeoutMs: number;
205
- maxConcurrentRequests: number;
206
- perRouteRequestsPerMinute: number;
207
- perIpRequestsPerMinute: number;
208
- };
209
- type RelayTargetPolicy = {
210
- allowedHosts: string[];
211
- blockedPorts: number[];
212
- allowPrivateNetworkTargets: boolean;
213
- };
214
- type RelayRouteClaim = {
215
- host: string;
216
- scope: string;
217
- expiresAt: string;
218
- agentId: string;
219
- };
220
- type SignedRelayRouteClaim = {
221
- payload: RelayRouteClaim;
222
- token: string;
223
- };
224
- type RelayRouteRegistrationInput = {
225
- authorizationHeader?: string | null;
226
- agentToken: string;
227
- claimToken: string;
228
- signingSecret: string;
229
- expectedScope: string;
230
- target: RelayLocalTarget;
231
- access?: RelayAccessMode;
232
- publicMode?: boolean;
233
- passwordProtected?: boolean;
234
- authRequired?: boolean;
235
- now?: Date;
236
- targetPolicy?: Partial<RelayTargetPolicy>;
237
- limits?: Partial<RelayLimits>;
238
- };
239
- type ActiveRelayRoute = {
240
- host: string;
241
- scope: string;
242
- agentId: string;
243
- expiresAt: string;
244
- target: Required<RelayLocalTarget>;
245
- access: RelayAccessMode;
246
- passwordProtected: boolean;
247
- authRequired: boolean;
248
- limits: RelayLimits;
249
- };
250
- type RelayOfflineResponse = {
251
- status: 503;
252
- headers: Record<string, string>;
253
- body: string;
254
- };
255
- declare const DEFAULT_RELAY_ALLOWED_TARGET_HOSTS: readonly ["localhost", "127.0.0.1", "::1"];
256
- declare const DEFAULT_RELAY_BLOCKED_PORTS: readonly [22, 2375, 2376, 5432, 6379, 9200, 9229, 27017];
257
- declare const DEFAULT_RELAY_LIMITS: RelayLimits;
258
- declare const DEFAULT_RELAY_TARGET_POLICY: RelayTargetPolicy;
259
- declare function assertExactRelayHost(host: string): string;
260
- declare function assertRelayLocalTarget(target: RelayLocalTarget, policyInput?: Partial<RelayTargetPolicy>): Required<RelayLocalTarget>;
261
- declare function authenticateRelayAgentToken(input: {
262
- authorizationHeader?: string | null;
263
- agentToken: string;
264
- }): boolean;
265
- declare function signRelayRouteClaim(claim: RelayRouteClaim, signingSecret: string): SignedRelayRouteClaim;
266
- declare function verifyRelayRouteClaim(token: string, signingSecret: string, options: {
267
- expectedScope: string;
268
- now?: Date;
269
- }): RelayRouteClaim;
270
- declare function createRelayRouteRegistration(input: RelayRouteRegistrationInput): ActiveRelayRoute;
271
- declare function isRelayRouteActive(route: ActiveRelayRoute, options: {
272
- agentConnected: boolean;
273
- now?: Date;
274
- }): boolean;
275
- declare function stripRelayForwardHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string | string[]>;
276
- declare function redactRelayHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string | string[]>;
277
- declare function redactRelayLogUrl(input: string): string;
278
- declare function renderRelayOfflineResponse(): RelayOfflineResponse;
279
-
280
507
  type DomainRoute = {
281
508
  host: string;
282
509
  port: number;
@@ -320,8 +547,31 @@ declare function readLocalghostState(cwd?: string): LocalghostState | null;
320
547
  declare function writeLocalghostState(cwd: string, state: WriteLocalghostStateInput): string;
321
548
  declare function patchLocalghostState(cwd: string, patch: Partial<WriteLocalghostStateInput>): string | null;
322
549
 
550
+ type VercelGhostTunnelRequestLike = {
551
+ headers: Record<string, string | string[] | undefined>;
552
+ url?: string;
553
+ method?: string;
554
+ [Symbol.asyncIterator]?: () => AsyncIterator<Buffer | Uint8Array | string>;
555
+ };
556
+ type VercelGhostTunnelResponseLike = {
557
+ setHeader(name: string, value: string): void;
558
+ end(body: string): void;
559
+ statusCode: number;
560
+ };
561
+ type CreateVercelGhostTunnelHandlerOptions = {
562
+ cwd?: string;
563
+ domain: string;
564
+ localghostConfig?: string | false;
565
+ ghostTunnelFile?: string;
566
+ ipSigningSecret?: string;
567
+ tunnelStore?: GhostTunnelStore;
568
+ tunnelEnv?: GhostTunnelStoreEnv;
569
+ authenticated?: boolean | ((request: VercelGhostTunnelRequestLike) => boolean | Promise<boolean>);
570
+ };
571
+ declare function createVercelGhostTunnelHandler(options: CreateVercelGhostTunnelHandlerOptions): (request: VercelGhostTunnelRequestLike, response: VercelGhostTunnelResponseLike) => Promise<void>;
572
+
323
573
  declare const LOCALGHOST_PACKAGE_NAME = "@hamedb89/localghost";
324
- declare const LOCALGHOST_VERSION = "0.1.10";
574
+ declare const LOCALGHOST_VERSION = "0.1.13";
325
575
  declare const UPDATE_CHECK_CACHE_TTL_MS: number;
326
576
  declare const UPDATE_CHECK_NOTIFY_TTL_MS: number;
327
577
  declare const UPDATE_CHECK_TIMEOUT_MS = 900;
@@ -358,4 +608,4 @@ declare function maybeNotifyAboutUpdate(options?: {
358
608
  disabled?: boolean;
359
609
  }): Promise<void>;
360
610
 
361
- export { type ActiveRelayRoute, type CaddyModeOptions, ConfigPattern, DEFAULT_RELAY_ALLOWED_TARGET_HOSTS, DEFAULT_RELAY_BLOCKED_PORTS, DEFAULT_RELAY_LIMITS, DEFAULT_RELAY_TARGET_POLICY, DevHostEntry, type DoctorResult, type DomainRoute, type DomainRouteOptions, type FindAvailablePortOptions, GhostTunnelConfig, GhostTunnelOptions, type InitOptions, type InitResult, LOCALGHOST_ACTIVITY_VERSION, LOCALGHOST_PACKAGE_NAME, LOCALGHOST_STATE_FILE, LOCALGHOST_VERSION, type LocalghostActivity, type LocalghostContext, type LocalghostContextOptions, type LocalghostEnvironment, type LocalghostProjectConfig, type LocalghostProjectConfigResult, type LocalghostRunMode, type LocalghostRunRecord, type LocalghostSetupRecord, type LocalghostState, type LocalghostStateAction, type PackageManager, ReadDevHostsOptions, type RegisterLocalghostRunInput, type RegisterLocalghostSetupInput, type RelayAccessMode, type RelayLimits, type RelayLocalTarget, type RelayOfflineResponse, type RelayProtocol, type RelayRouteClaim, type RelayRouteRegistrationInput, type RelayTargetPolicy, type RemoveSystemHostsResult, type SignedRelayRouteClaim, UPDATE_CHECK_CACHE_TTL_MS, UPDATE_CHECK_NOTIFY_TTL_MS, UPDATE_CHECK_TIMEOUT_MS, type UpdateCheckCache, type UpdateCheckResult, type UpdateSystemHostsResult, type WriteLocalghostStateInput, assertExactRelayHost, assertLocalDevelopment, assertRelayLocalTarget, authenticateRelayAgentToken, checkCaddy, checkForUpdate, compareVersions, createRelayRouteRegistration, defineLocalghostConfig, detectPackageManager, findAvailablePort, formatDomainRoutes, formatGhostTunnel, formatUpdateMessage, getCaddyfilePath, getDomainRoutes, getLocalghostActivityPath, getLocalghostStatePath, getProductionEnvKeys, getProductionReason, getSystemHostsPath, getUpdateCheckCachePath, initLocalghost, isNewerVersion, isPortAvailable, isProcessRunning, isProductionLike, isRelayRouteActive, isUpdateCheckDisabled, listLocalghostRuns, listLocalghostSetups, markUpdateNotified, maybeNotifyAboutUpdate, packageAddCommand, packageRunCommand, patchLocalghostState, pruneLocalghostActivity, readLocalghostActivity, readLocalghostProjectConfig, readLocalghostState, redactRelayHeaders, redactRelayLogUrl, registerLocalghostRun, registerLocalghostSetup, removeManagedBlock, removeSystemHosts, renderCaddyfile, renderHostsBlock, renderRelayOfflineResponse, resolveLocalghostContext, runCaddy, runDoctor, shouldNotifyAboutUpdate, signRelayRouteClaim, startCaddy, stripRelayForwardHeaders, trustCaddy, unregisterLocalghostRun, unregisterLocalghostSetup, updateSystemHosts, upsertManagedBlock, validateCaddyfile, verifyRelayRouteClaim, writeCaddyfile, writeLocalghostActivity, writeLocalghostState };
611
+ export { type ActiveRelayRoute, type CaddyModeOptions, 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 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_GHOST_TUNNEL_FILE, LOCALGHOST_PACKAGE_NAME, LOCALGHOST_STATE_FILE, LOCALGHOST_VERSION, type LocalghostActivity, type LocalghostContext, type LocalghostContextOptions, type LocalghostEnvironment, type LocalghostPackageManager, type LocalghostProjectConfig, type LocalghostProjectConfigResult, type LocalghostRunMode, type LocalghostRunRecord, type LocalghostServiceOptions, type LocalghostSetupRecord, type LocalghostState, type LocalghostStateAction, type PackageManager, 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, ResolvedDevHostsPath, type ResolvedGhostTunnelIpRedirect, type 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, checkCaddy, checkForUpdate, compareVersions, constructGhostTunnelIpUrl, createGhostTunnelQueuedRequest, createGhostTunnelRouteHeartbeat, createMemoryGhostTunnelStore, createRedisGhostTunnelStore, createRedisGhostTunnelStoreFromEnv, createRelayRouteRegistration, createVercelGhostTunnelHandler, decodeGhostTunnelBody, defineLocalghostConfig, detectDevCommand, detectDevPackageManager, detectDevServices, detectPackageManager, encodeGhostTunnelBody, findAvailablePort, findGhostTunnelEntry, formatDetectedDevCommand, formatDetectedDevServices, formatDomainRoutes, formatGhostTunnel, formatUpdateMessage, getCaddyfilePath, getDomainRoutes, getGhostTunnelPath, getLocalghostActivityPath, 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, startCaddy, startGhostTunnelAgent, stripRelayForwardHeaders, trustCaddy, unregisterLocalghostRun, unregisterLocalghostSetup, updateSystemHosts, upsertManagedBlock, validateCaddyfile, verifyGhostTunnelIpTransportClaim, verifyRelayRouteClaim, writeCaddyfile, writeLocalghostActivity, writeLocalghostState };