Comparing version 1.3.1 to 1.4.0
import * as citty from 'citty'; | ||
import { ParsedArgs } from 'citty'; | ||
import { L as ListenOptions } from './shared/listhen.47f57103.js'; | ||
import 'node:http'; | ||
import 'node:https'; | ||
import 'get-port-please'; | ||
declare const main: citty.CommandDef<{ | ||
cwd: { | ||
type: "string"; | ||
description: string; | ||
}; | ||
entry: { | ||
type: "positional"; | ||
description: string; | ||
required: true; | ||
}; | ||
port: { | ||
type: "string"; | ||
description: string; | ||
readonly type: "string"; | ||
readonly description: "Port to listen on (use PORT environment variable to override)"; | ||
}; | ||
host: { | ||
type: "string"; | ||
description: string; | ||
readonly type: "string"; | ||
readonly description: "Host to listen on (use HOST environment variable to override)"; | ||
}; | ||
clipboard: { | ||
type: "boolean"; | ||
description: string; | ||
default: false; | ||
readonly type: "boolean"; | ||
readonly description: "Copy the URL to the clipboard"; | ||
readonly default: false; | ||
}; | ||
open: { | ||
type: "boolean"; | ||
description: string; | ||
default: false; | ||
readonly type: "boolean"; | ||
readonly description: "Open the URL in the browser"; | ||
readonly default: false; | ||
}; | ||
baseURL: { | ||
type: "string"; | ||
description: string; | ||
}; | ||
name: { | ||
type: "string"; | ||
description: string; | ||
}; | ||
https: { | ||
type: "boolean"; | ||
description: string; | ||
default: false; | ||
readonly type: "boolean"; | ||
readonly description: "Enable HTTPS"; | ||
readonly default: false; | ||
}; | ||
"https.cert": { | ||
type: "string"; | ||
description: string; | ||
readonly type: "string"; | ||
readonly description: "Path to TLS certificate used with HTTPS in PEM format"; | ||
}; | ||
"https.key": { | ||
type: "string"; | ||
description: string; | ||
readonly type: "string"; | ||
readonly description: "Path to TLS key used with HTTPS in PEM format"; | ||
}; | ||
"https.pfx": { | ||
type: "string"; | ||
description: string; | ||
readonly type: "string"; | ||
readonly description: "Path to PKCS#12 (.p12/.pfx) keystore containing a TLS certificate and Key"; | ||
}; | ||
"https.passphrase": { | ||
readonly type: "string"; | ||
readonly description: "Passphrase used for TLS key or keystore"; | ||
}; | ||
"https.validityDays": { | ||
readonly type: "string"; | ||
readonly description: "Validity in days of the autogenerated TLS certificate (https: true)"; | ||
}; | ||
"https.domains": { | ||
readonly type: "string"; | ||
readonly description: "Comma seperated list of domains and IPs, the autogenerated certificate should be valid for (https: true)"; | ||
}; | ||
publicURL: { | ||
readonly type: "string"; | ||
readonly description: "Displayed public URL (used for QR code)"; | ||
readonly required: false; | ||
}; | ||
qr: { | ||
readonly type: "boolean"; | ||
readonly description: "Display The QR code of public URL when available"; | ||
readonly required: false; | ||
}; | ||
public: { | ||
readonly type: "boolean"; | ||
readonly description: "Listen to all network interfaces"; | ||
readonly required: false; | ||
}; | ||
tunnel: { | ||
readonly type: "boolean"; | ||
readonly description: "Open a tunnel using https://github.com/unjs/untun"; | ||
readonly required: false; | ||
}; | ||
cwd: { | ||
type: "string"; | ||
description: string; | ||
}; | ||
"https.validityDays": { | ||
entry: { | ||
type: "positional"; | ||
description: string; | ||
required: true; | ||
}; | ||
name: { | ||
type: "string"; | ||
description: string; | ||
}; | ||
"https.domains": { | ||
baseURL: { | ||
type: "string"; | ||
@@ -74,25 +99,78 @@ description: string; | ||
}; | ||
publicURL: { | ||
type: "string"; | ||
description: string; | ||
required: false; | ||
}>; | ||
declare const runMain: () => Promise<void>; | ||
/** Returns unjs/citty compatible args object */ | ||
declare function getArgs(): { | ||
readonly port: { | ||
readonly type: "string"; | ||
readonly description: "Port to listen on (use PORT environment variable to override)"; | ||
}; | ||
qr: { | ||
type: "boolean"; | ||
description: string; | ||
required: false; | ||
readonly host: { | ||
readonly type: "string"; | ||
readonly description: "Host to listen on (use HOST environment variable to override)"; | ||
}; | ||
public: { | ||
type: "boolean"; | ||
description: string; | ||
required: false; | ||
readonly clipboard: { | ||
readonly type: "boolean"; | ||
readonly description: "Copy the URL to the clipboard"; | ||
readonly default: false; | ||
}; | ||
tunnel: { | ||
type: "boolean"; | ||
description: string; | ||
required: false; | ||
readonly open: { | ||
readonly type: "boolean"; | ||
readonly description: "Open the URL in the browser"; | ||
readonly default: false; | ||
}; | ||
}>; | ||
declare const runMain: () => Promise<void>; | ||
readonly https: { | ||
readonly type: "boolean"; | ||
readonly description: "Enable HTTPS"; | ||
readonly default: false; | ||
}; | ||
readonly "https.cert": { | ||
readonly type: "string"; | ||
readonly description: "Path to TLS certificate used with HTTPS in PEM format"; | ||
}; | ||
readonly "https.key": { | ||
readonly type: "string"; | ||
readonly description: "Path to TLS key used with HTTPS in PEM format"; | ||
}; | ||
readonly "https.pfx": { | ||
readonly type: "string"; | ||
readonly description: "Path to PKCS#12 (.p12/.pfx) keystore containing a TLS certificate and Key"; | ||
}; | ||
readonly "https.passphrase": { | ||
readonly type: "string"; | ||
readonly description: "Passphrase used for TLS key or keystore"; | ||
}; | ||
readonly "https.validityDays": { | ||
readonly type: "string"; | ||
readonly description: "Validity in days of the autogenerated TLS certificate (https: true)"; | ||
}; | ||
readonly "https.domains": { | ||
readonly type: "string"; | ||
readonly description: "Comma seperated list of domains and IPs, the autogenerated certificate should be valid for (https: true)"; | ||
}; | ||
readonly publicURL: { | ||
readonly type: "string"; | ||
readonly description: "Displayed public URL (used for QR code)"; | ||
readonly required: false; | ||
}; | ||
readonly qr: { | ||
readonly type: "boolean"; | ||
readonly description: "Display The QR code of public URL when available"; | ||
readonly required: false; | ||
}; | ||
readonly public: { | ||
readonly type: "boolean"; | ||
readonly description: "Listen to all network interfaces"; | ||
readonly required: false; | ||
}; | ||
readonly tunnel: { | ||
readonly type: "boolean"; | ||
readonly description: "Open a tunnel using https://github.com/unjs/untun"; | ||
readonly required: false; | ||
}; | ||
}; | ||
type ParsedListhenArgs = ParsedArgs<ReturnType<typeof getArgs>>; | ||
/** Convert unjs/citty compatible args to listhen options */ | ||
declare function parseArgs(args: ParsedListhenArgs): Partial<ListenOptions>; | ||
export { main, runMain }; | ||
export { getArgs, main, parseArgs, runMain }; |
@@ -1,72 +0,9 @@ | ||
import { Server, RequestListener } from 'node:http'; | ||
import { Server as Server$1 } from 'node:https'; | ||
import { GetPortInput } from 'get-port-please'; | ||
import { RequestListener } from 'node:http'; | ||
import { L as ListenOptions, a as Listener } from './shared/listhen.47f57103.js'; | ||
export { C as Certificate, G as GetURLOptions, H as HTTPSOptions, b as ListenURL, S as ShowURLOptions } from './shared/listhen.47f57103.js'; | ||
import { ConsolaInstance } from 'consola'; | ||
import * as h3 from 'h3'; | ||
import 'node:https'; | ||
import 'get-port-please'; | ||
interface Certificate { | ||
key: string; | ||
cert: string; | ||
passphrase?: string; | ||
} | ||
interface HTTPSOptions { | ||
cert?: string; | ||
key?: string; | ||
pfx?: string; | ||
passphrase?: string; | ||
validityDays?: number; | ||
domains?: string[]; | ||
} | ||
interface ListenOptions { | ||
name: string; | ||
port: GetPortInput; | ||
hostname: string; | ||
showURL: boolean; | ||
baseURL: string; | ||
open: boolean; | ||
https: boolean | HTTPSOptions; | ||
clipboard: boolean; | ||
isTest: boolean; | ||
isProd: boolean; | ||
autoClose: boolean; | ||
_entry?: string; | ||
/** | ||
* Used as main public url to display | ||
* @default The first public IPV4 address listening to | ||
*/ | ||
publicURL?: string; | ||
/** | ||
* Print QR Code for public IPv4 address | ||
* | ||
* @default true | ||
*/ | ||
qr?: boolean; | ||
/** | ||
* When enabled, listhen tries to listen to all network interfaces | ||
* | ||
* @default `false` for development and `true` for production | ||
*/ | ||
public: boolean; | ||
/** | ||
* Open a tunnel using https://github.com/unjs/untun | ||
*/ | ||
tunnel?: boolean; | ||
} | ||
type GetURLOptions = Pick<Partial<ListenOptions>, "baseURL" | "publicURL">; | ||
type ShowURLOptions = Pick<Partial<ListenOptions>, "baseURL" | "name" | "publicURL" | "qr">; | ||
interface ListenURL { | ||
url: string; | ||
type: "local" | "network" | "tunnel"; | ||
} | ||
interface Listener { | ||
url: string; | ||
address: any; | ||
server: Server | Server$1; | ||
https: false | Certificate; | ||
close: () => Promise<void>; | ||
open: () => Promise<void>; | ||
showURL: (options?: ShowURLOptions) => Promise<void>; | ||
getURLs: (options?: GetURLOptions) => Promise<ListenURL[]>; | ||
} | ||
declare function listen(handle: RequestListener, _options?: Partial<ListenOptions>): Promise<Listener>; | ||
@@ -101,2 +38,2 @@ | ||
export { type Certificate, type DevServerOptions, type GetURLOptions, type HTTPSOptions, type ListenOptions, type ListenURL, type Listener, type ShowURLOptions, type WatchOptions, createDevServer, listen, listenAndWatch }; | ||
export { type DevServerOptions, ListenOptions, Listener, type WatchOptions, createDevServer, listen, listenAndWatch }; |
{ | ||
"name": "listhen", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "👂 Elegant HTTP Listener", | ||
@@ -28,3 +28,4 @@ "repository": "unjs/listhen", | ||
"lib", | ||
"bin" | ||
"bin", | ||
"cli.d.ts" | ||
], | ||
@@ -31,0 +32,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206643
21
5853