Skip to content

Commit

Permalink
build: generate build
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasDemea committed Jul 2, 2024
1 parent 2b7cbc4 commit e45bb0c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 781 deletions.
372 changes: 2 additions & 370 deletions dist/cjs/index.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/cjs/index.cjs.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions dist/dts/error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare const _default: (code: string, message: string | (string | undefined)[], ...contexts: Record<string, object>[]) => {
[index: string]: unknown;
code: string;
name: string;
message: string;
stack?: string;
};
export default _default;
45 changes: 45 additions & 0 deletions dist/dts/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export type HookHandler<T> = (args: T, handler?: HookHandler<T>) => null | void | HookHandler<T> | Promise<HookHandler<T>>;
export interface Hook<T> {
after?: string | string[];
before?: string | string[];
handler: HookHandler<T>;
name?: PropertyKey;
plugin?: string;
require?: string | string[];
}
export interface Plugin<T> {
hooks: {
[name in keyof T]: Hook<T[name]>[] | Hook<T[name]> | HookHandler<T[name]>;
};
name: PropertyKey;
require?: string[];
}
interface callArguments<T, K extends keyof T> {
args: T[K];
handler: HookHandler<T[K]>;
hooks?: Hook<T[K]>[];
name: K;
}
interface getArguments<T, K extends keyof T> {
hooks?: Hook<T[K]>[];
name: K;
sort?: boolean;
}
type CallFunction<T> = <K extends keyof T>(args: callArguments<T, K>) => Promise<unknown>;
type CallSyncFunction<T> = <K extends keyof T>(args: callArguments<T, K>) => unknown;
type GetFunction<T> = <K extends keyof T>(args: getArguments<T, K>) => Hook<T[K]>[];
interface Registry<T> {
call: CallFunction<T>;
call_sync: CallSyncFunction<T>;
get: GetFunction<T>;
register: (userPlugin: Plugin<T> | ((...args: unknown[]) => Plugin<T>)) => Registry<T>;
registered: (name: PropertyKey) => boolean;
}
interface plugangplayArguments<T> {
args?: unknown[];
chain?: Registry<T>;
parent?: Registry<T>;
plugins?: Plugin<T>[];
}
declare const plugandplay: <T extends Record<string, unknown> = Record<string, unknown>>({ args, chain, parent, plugins, }?: plugangplayArguments<T>) => Registry<T>;
export { plugandplay };
Loading

0 comments on commit e45bb0c

Please sign in to comment.