From da0a31277f14454bae6dbd2d778d470d0a115558 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Sun, 12 Jan 2025 21:28:36 +0300 Subject: [PATCH] chore: update target --- target/dts/error.d.ts | 2 +- target/dts/index.d.ts | 2 +- target/dts/mixin/pipe.d.ts | 5 +++++ target/dts/spawn.d.ts | 43 +++++++++++++++++++++++++++++++++++++- target/dts/util.d.ts | 2 +- target/dts/x.d.ts | 25 ++++++++++++++++++++++ target/dts/zurk.d.ts | 2 +- 7 files changed, 76 insertions(+), 5 deletions(-) diff --git a/target/dts/error.d.ts b/target/dts/error.d.ts index 129207c..26b8528 100644 --- a/target/dts/error.d.ts +++ b/target/dts/error.d.ts @@ -1,5 +1,5 @@ /** - * @module zurk/error + * @module * * Zurk spawn error codes & handling utilities * diff --git a/target/dts/index.d.ts b/target/dts/index.d.ts index dd733b7..c8896a4 100644 --- a/target/dts/index.d.ts +++ b/target/dts/index.d.ts @@ -6,7 +6,7 @@ export { $ } from './x.js'; export { zurk } from './zurk.js'; export { type Promisified, buildCmd } from './util.js'; /** - * @module zurk + * @module * * A generic process spawner * diff --git a/target/dts/mixin/pipe.d.ts b/target/dts/mixin/pipe.d.ts index af48a66..b6f3b48 100644 --- a/target/dts/mixin/pipe.d.ts +++ b/target/dts/mixin/pipe.d.ts @@ -1,2 +1,7 @@ import type { TMixin } from '../x.js'; +/** + * @module + * + * Zurk $ pipe mixin + */ export declare const pipeMixin: TMixin; diff --git a/target/dts/spawn.d.ts b/target/dts/spawn.d.ts index 59c520f..5a0a514 100644 --- a/target/dts/spawn.d.ts +++ b/target/dts/spawn.d.ts @@ -3,7 +3,7 @@ import EventEmitter from 'node:events'; import { Buffer } from 'node:buffer'; import { Readable, Writable, Stream, Transform } from 'node:stream'; /** - * @module zurk/spawn + * @module * * Zurk internal child_process caller API * @@ -96,12 +96,34 @@ export interface TSpawnCtxNormalized { run: (cb: () => void, ctx: TSpawnCtxNormalized) => void; stack: string; } +/** + * zurk default settings + */ export declare const defaults: TSpawnCtxNormalized; +/** + * Normalizes spawn context. + * + * @param ctxs Contexts to normalize + * @returns + */ export declare const normalizeCtx: (...ctxs: TSpawnCtx[]) => TSpawnCtxNormalized; +/** + * Redirects input to child process stdin + * @param child + * @param input + */ export declare const processInput: (child: TChild, input?: TInput | null) => void; +/** + * Transformer that emits data but does not consume it. + */ export declare class VoidStream extends Transform { _transform(chunk: any, _: string, cb: (err?: Error) => void): void; } +/** + * Builds spawn options + * @param ctx + * @returns spawn options + */ export declare const buildSpawnOpts: ({ spawnOpts, stdio, cwd, shell, input, env, detached, signal }: TSpawnCtxNormalized) => { env: Record; cwd: string; @@ -112,7 +134,26 @@ export declare const buildSpawnOpts: ({ spawnOpts, stdio, cwd, shell, input, env detached: boolean; signal: AbortSignal; }; +/** + * Toggles event listeners + * @param pos 'on' | 'off' + * @param ee EventEmitter + * @param on listeners map + */ export declare const toggleListeners: (pos: "on" | "off", ee: EventEmitter, on?: Partial) => void; +/** + * Creates a new spawn store + */ export declare const createStore: () => TSpawnStore; +/** + * Invokes a child process + * @param c Normalized context. + * @returns Normalized context. + */ export declare const invoke: (c: TSpawnCtxNormalized) => TSpawnCtxNormalized; +/** + * Executes a child process + * @param ctx TSpawnCtx + * @returns TSpawnCtxNormalized + */ export declare const exec: (ctx: TSpawnCtx) => TSpawnCtxNormalized; diff --git a/target/dts/util.d.ts b/target/dts/util.d.ts index 3b2d8a2..bfa266a 100644 --- a/target/dts/util.d.ts +++ b/target/dts/util.d.ts @@ -1,7 +1,7 @@ import { Stream } from 'node:stream'; import { Buffer } from 'node:buffer'; /** - * @module zurk/util + * @module * * Zurk utility functions * diff --git a/target/dts/x.d.ts b/target/dts/x.d.ts index 47b7dcf..8da3a31 100644 --- a/target/dts/x.d.ts +++ b/target/dts/x.d.ts @@ -1,6 +1,18 @@ import type { Readable, Writable } from 'node:stream'; import { TZurk, TZurkPromise, TZurkOptions, TZurkCtx } from './zurk.js'; import { type Promisified, type TVoidCallback, type TQuote } from './util.js'; +/** + * @module + * + * Zurk $ API + * + * @example + * ```ts + * import {$} from 'zurk/x' + * + * const p = await $`echo foo`' + * ``` + */ export interface TShellCtxExtra { } export interface TShellExtra { @@ -50,5 +62,18 @@ export interface TShellSync { (this: O, pieces?: TemplateStringsArray, ...args: any[]): TShellResponseSync; (opts: TShellOptions): TShellSync; } +/** + * Zurk $ template API + * + * @param pieces + * @param args + */ export declare const $: TShell; +/** + * Applies mixins to the result. + * @param $ + * @param result + * @param parent + * @returns TZurk | TZurkPromise | TShellOptions + */ export declare const applyMixins: ($: TShell, result: TZurk | TZurkPromise | TShellOptions, parent?: TZurk | TZurkPromise) => TZurk | TZurkPromise | TShellOptions; diff --git a/target/dts/zurk.d.ts b/target/dts/zurk.d.ts index 23f0167..df90afe 100644 --- a/target/dts/zurk.d.ts +++ b/target/dts/zurk.d.ts @@ -1,7 +1,7 @@ import { type TSpawnCtxNormalized, type TSpawnResult, type TSpawnListeners } from './spawn.js'; import { type Promisified } from './util.js'; /** - * @module zurk/zurk + * @module * * Zurk process spawner *