First upload version 0.0.1

This commit is contained in:
Neyra
2026-02-05 15:27:49 +08:00
commit 8e9b7201ed
4182 changed files with 593136 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import type { Options, Primitives } from '../types';
export type ArgumentFilterPredicate<T> = (input: T | unknown) => input is T;
export declare function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>): K extends T ? T : undefined;
export declare function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>, def: T): T;
export declare const filterArray: ArgumentFilterPredicate<Array<unknown>>;
export declare function filterPrimitives(input: unknown, omit?: Array<'boolean' | 'string' | 'number'>): input is Primitives;
export declare const filterNumber: ArgumentFilterPredicate<number>;
export declare const filterString: ArgumentFilterPredicate<string>;
export declare const filterStringOrStringArray: ArgumentFilterPredicate<string | string[]>;
export declare function filterPlainObject<T extends Options>(input: T | unknown): input is T;
export declare function filterFunction(input: unknown): input is (...args: unknown[]) => unknown;
export declare const filterHasLength: ArgumentFilterPredicate<{
length: number;
}>;

View File

@@ -0,0 +1,10 @@
/**
* Known process exit codes used by the task parsers to determine whether an error
* was one they can automatically handle
*/
export declare enum ExitCodes {
SUCCESS = 0,
ERROR = 1,
NOT_FOUND = -2,
UNCLEAN = 128
}

View File

@@ -0,0 +1,7 @@
import { TaskResponseFormat } from '../types';
export declare class GitOutputStreams<T extends TaskResponseFormat = Buffer> {
readonly stdOut: T;
readonly stdErr: T;
constructor(stdOut: T, stdErr: T);
asStrings(): GitOutputStreams<string>;
}

View File

@@ -0,0 +1,8 @@
export * from './argument-filters';
export * from './exit-codes';
export * from './git-output-streams';
export * from './line-parser';
export * from './simple-git-options';
export * from './task-options';
export * from './task-parser';
export * from './util';

View File

@@ -0,0 +1,15 @@
export declare class LineParser<T> {
protected matches: string[];
protected useMatches: (target: T, match: string[]) => boolean | void;
private _regExp;
constructor(regExp: RegExp | RegExp[], useMatches?: (target: T, match: string[]) => boolean | void);
parse: (line: (offset: number) => string | undefined, target: T) => boolean;
protected resetMatches(): void;
protected prepareMatches(): string[];
protected addMatch(reg: RegExp, index: number, line?: string): boolean;
protected pushMatch(_index: number, matched: string[]): void;
}
export declare class RemoteLineParser<T> extends LineParser<T> {
protected addMatch(reg: RegExp, index: number, line?: string): boolean;
protected pushMatch(index: number, matched: string[]): void;
}

View File

@@ -0,0 +1,2 @@
import { SimpleGitOptions } from '../types';
export declare function createInstanceConfig(...options: Array<Partial<SimpleGitOptions> | undefined>): SimpleGitOptions;

View File

@@ -0,0 +1,13 @@
import { Maybe, Options } from '../types';
export declare function appendTaskOptions<T extends Options = Options>(options: Maybe<T>, commands?: string[]): string[];
export declare function getTrailingOptions(args: IArguments, initialPrimitive?: number, objectOnly?: boolean): string[];
/**
* Given any number of arguments, returns the trailing options argument, ignoring a trailing function argument
* if there is one. When not found, the return value is null.
*/
export declare function trailingOptionsArgument(args: IArguments): Maybe<Options>;
/**
* Returns either the source argument when it is a `Function`, or the default
* `NOOP` function constant
*/
export declare function trailingFunctionArgument(args: unknown[] | IArguments | unknown, includeNoop?: boolean): Maybe<(...args: unknown[]) => unknown>;

View File

@@ -0,0 +1,5 @@
import type { MaybeArray, TaskParser, TaskResponseFormat } from '../types';
import { GitOutputStreams } from './git-output-streams';
import { LineParser } from './line-parser';
export declare function callTaskParser<INPUT extends TaskResponseFormat, RESPONSE>(parser: TaskParser<INPUT, RESPONSE>, streams: GitOutputStreams<INPUT>): RESPONSE;
export declare function parseStringResponse<T>(result: T, parsers: LineParser<T>[], texts: MaybeArray<string>, trim?: boolean): T;

48
node_modules/simple-git/dist/src/lib/utils/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import { Buffer } from 'node:buffer';
import type { Maybe } from '../types';
type Callable = (...args: unknown[]) => unknown;
export declare const NULL = "\0";
export declare const NOOP: Callable;
/**
* Returns either the source argument when it is a `Function`, or the default
* `NOOP` function constant
*/
export declare function asFunction<T>(source: T | unknown): Callable;
/**
* Determines whether the supplied argument is both a function, and is not
* the `NOOP` function.
*/
export declare function isUserFunction<T extends Function>(source: T | unknown): source is T;
export declare function splitOn(input: string, char: string): [string, string];
export declare function first<T extends unknown[]>(input: T, offset?: number): Maybe<T[number]>;
export declare function first<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;
export declare function last<T extends unknown[]>(input: T, offset?: number): Maybe<T[number]>;
export declare function last<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;
export declare function last<T>(input: T, offset?: number): Maybe<unknown>;
export declare function toLinesWithContent(input?: string, trimmed?: boolean, separator?: string): string[];
type LineWithContentCallback<T = void> = (line: string) => T;
export declare function forEachLineWithContent<T>(input: string, callback: LineWithContentCallback<T>): T[];
export declare function folderExists(path: string): boolean;
/**
* Adds `item` into the `target` `Array` or `Set` when it is not already present and returns the `item`.
*/
export declare function append<T>(target: T[] | Set<T>, item: T): typeof item;
/**
* Adds `item` into the `target` `Array` when it is not already present and returns the `target`.
*/
export declare function including<T>(target: T[], item: T): typeof target;
export declare function remove<T>(target: Set<T> | T[], item: T): T;
export declare const objectToString: (input: unknown) => string;
export declare function asArray<T>(source: T | T[]): T[];
export declare function asCamelCase(str: string): string;
export declare function asStringArray<T>(source: T | T[]): string[];
export declare function asNumber(source: string | null | undefined, onNaN?: number): number;
export declare function prefixedArray<T>(input: T[], prefix: T): T[];
export declare function bufferToString(input: Buffer | Buffer[]): string;
/**
* Get a new object from a source object with only the listed properties.
*/
export declare function pick<T, K extends keyof T>(source: T, properties: readonly K[]): Partial<Pick<T, K>>;
export declare function delay(duration?: number): Promise<void>;
export declare function orVoid<T>(input: T | false): T | undefined;
export {};