Initial commit - full huishou project

This commit is contained in:
jiapengyu
2026-07-27 14:07:26 +08:00
commit 60790ad1b3
39127 changed files with 5989265 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
import { SimpleGitOptions } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function abortPlugin(signal: SimpleGitOptions['abort']): (SimpleGitPlugin<"spawn.before"> | SimpleGitPlugin<"spawn.after">)[] | undefined;
@@ -0,0 +1,3 @@
import type { SimpleGitPluginConfig } from '../types';
import type { SimpleGitPlugin } from './simple-git-plugin';
export declare function blockUnsafeOperationsPlugin(options?: SimpleGitPluginConfig['unsafe']): SimpleGitPlugin<'spawn.args'>;
@@ -0,0 +1,2 @@
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function commandConfigPrefixingPlugin(configuration: string[]): SimpleGitPlugin<'spawn.args'>;
@@ -0,0 +1,3 @@
import { SimpleGitPluginConfig } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function completionDetectionPlugin({ onClose, onExit, }?: SimpleGitPluginConfig['completion']): SimpleGitPlugin<'spawn.after'>;
@@ -0,0 +1,3 @@
import type { SimpleGitOptions } from '../types';
import { PluginStore } from './plugin-store';
export declare function customBinaryPlugin(plugins: PluginStore, input?: SimpleGitOptions['binary'], allowUnsafe?: boolean): void;
@@ -0,0 +1,7 @@
import { GitExecutorResult, SimpleGitPluginConfig } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
type TaskResult = Omit<GitExecutorResult, 'rejection'>;
declare function isTaskError(result: TaskResult): boolean;
export declare function errorDetectionHandler(overwrite?: boolean, isError?: typeof isTaskError, errorMessage?: (result: TaskResult) => Buffer | Error): (error: Buffer | Error | undefined, result: TaskResult) => Error | Buffer<ArrayBufferLike> | undefined;
export declare function errorDetectionPlugin(config: SimpleGitPluginConfig['errors']): SimpleGitPlugin<'task.error'>;
export {};
+11
View File
@@ -0,0 +1,11 @@
export * from './abort-plugin';
export { blockUnsafeOperationsPlugin } from './block-unsafe-operations-plugin';
export * from './command-config-prefixing-plugin';
export * from './completion-detection.plugin';
export * from './custom-binary.plugin';
export * from './error-detection.plugin';
export * from './plugin-store';
export * from './progress-monitor-plugin';
export * from './simple-git-plugin';
export * from './spawn-options-plugin';
export * from './timout-plugin';
+11
View File
@@ -0,0 +1,11 @@
import type { SimpleGitPlugin, SimpleGitPluginType, SimpleGitPluginTypes } from './simple-git-plugin';
import type { SimpleGitPluginConfig } from '../types';
export declare class PluginStore {
private plugins;
private events;
on<K extends keyof SimpleGitPluginConfig>(type: K, listener: (data: SimpleGitPluginConfig[K]) => void): void;
reconfigure<K extends keyof SimpleGitPluginConfig>(type: K, data: SimpleGitPluginConfig[K]): void;
append<T extends SimpleGitPluginType>(type: T, action: SimpleGitPlugin<T>['action']): () => boolean;
add<T extends SimpleGitPluginType>(plugin: void | SimpleGitPlugin<T> | SimpleGitPlugin<T>[]): () => void;
exec<T extends SimpleGitPluginType>(type: T, data: SimpleGitPluginTypes[T]['data'], context: SimpleGitPluginTypes[T]['context']): typeof data;
}
@@ -0,0 +1,3 @@
import { SimpleGitOptions } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function progressMonitorPlugin(progress: Exclude<SimpleGitOptions['progress'], void>): (SimpleGitPlugin<"spawn.after"> | SimpleGitPlugin<"spawn.args">)[];
+48
View File
@@ -0,0 +1,48 @@
import { ChildProcess, SpawnOptions } from 'child_process';
import { GitExecutorResult } from '../types';
type SimpleGitTaskPluginContext = {
readonly method: string;
readonly commands: string[];
};
export interface SimpleGitPluginTypes {
'spawn.args': {
data: string[];
context: SimpleGitTaskPluginContext & {
env: Record<string, string | undefined>;
};
};
'spawn.binary': {
data: string;
context: SimpleGitTaskPluginContext & {};
};
'spawn.options': {
data: Partial<SpawnOptions>;
context: SimpleGitTaskPluginContext & {};
};
'spawn.before': {
data: void;
context: SimpleGitTaskPluginContext & {
kill(reason: Error): void;
};
};
'spawn.after': {
data: void;
context: SimpleGitTaskPluginContext & {
spawned: ChildProcess;
close(exitCode: number, reason?: Error): void;
kill(reason: Error): void;
};
};
'task.error': {
data: {
error?: Error;
};
context: SimpleGitTaskPluginContext & GitExecutorResult;
};
}
export type SimpleGitPluginType = keyof SimpleGitPluginTypes;
export interface SimpleGitPlugin<T extends SimpleGitPluginType> {
action(data: SimpleGitPluginTypes[T]['data'], context: SimpleGitPluginTypes[T]['context']): typeof data;
type: T;
}
export {};
@@ -0,0 +1,3 @@
import { SpawnOptions } from 'child_process';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function spawnOptionsPlugin(spawnOptions: Partial<SpawnOptions>): SimpleGitPlugin<'spawn.options'>;
@@ -0,0 +1,2 @@
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function suffixPathsPlugin(): SimpleGitPlugin<'spawn.args'>;
+3
View File
@@ -0,0 +1,3 @@
import type { SimpleGitPlugin } from './simple-git-plugin';
import type { SimpleGitOptions } from '../types';
export declare function timeoutPlugin({ block, stdErr, stdOut, }: Exclude<SimpleGitOptions['timeout'], undefined>): SimpleGitPlugin<'spawn.after'> | void;