@addfox/common 0.1.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/cjs/errors/index.d.ts +86 -0
- package/dist/cjs/errors/index.d.ts.map +1 -0
- package/dist/cjs/hooks/HookManager.d.ts +67 -0
- package/dist/cjs/hooks/HookManager.d.ts.map +1 -0
- package/dist/cjs/hooks/index.d.ts +7 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -0
- package/dist/cjs/hooks/types.d.ts +26 -0
- package/dist/cjs/hooks/types.d.ts.map +1 -0
- package/dist/cjs/index.cjs +756 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/interfaces/index.d.ts +56 -0
- package/dist/cjs/interfaces/index.d.ts.map +1 -0
- package/dist/cjs/logger/index.d.ts +171 -0
- package/dist/cjs/logger/index.d.ts.map +1 -0
- package/dist/cjs/utils/cache.d.ts +28 -0
- package/dist/cjs/utils/cache.d.ts.map +1 -0
- package/dist/cjs/utils/index.d.ts +7 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/object.d.ts +52 -0
- package/dist/cjs/utils/object.d.ts.map +1 -0
- package/dist/cjs/utils/pipeline.d.ts +45 -0
- package/dist/cjs/utils/pipeline.d.ts.map +1 -0
- package/dist/cjs/webExtStdoutOrigin.d.ts +4 -0
- package/dist/cjs/webExtStdoutOrigin.d.ts.map +1 -0
- package/dist/esm/errors/index.d.ts +86 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/hooks/HookManager.d.ts +67 -0
- package/dist/esm/hooks/HookManager.d.ts.map +1 -0
- package/dist/esm/hooks/index.d.ts +7 -0
- package/dist/esm/hooks/index.d.ts.map +1 -0
- package/dist/esm/hooks/types.d.ts +26 -0
- package/dist/esm/hooks/types.d.ts.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +567 -0
- package/dist/esm/interfaces/index.d.ts +56 -0
- package/dist/esm/interfaces/index.d.ts.map +1 -0
- package/dist/esm/logger/index.d.ts +171 -0
- package/dist/esm/logger/index.d.ts.map +1 -0
- package/dist/esm/utils/cache.d.ts +28 -0
- package/dist/esm/utils/cache.d.ts.map +1 -0
- package/dist/esm/utils/index.d.ts +7 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/object.d.ts +52 -0
- package/dist/esm/utils/object.d.ts.map +1 -0
- package/dist/esm/utils/pipeline.d.ts +45 -0
- package/dist/esm/utils/pipeline.d.ts.map +1 -0
- package/dist/esm/webExtStdoutOrigin.d.ts +4 -0
- package/dist/esm/webExtStdoutOrigin.d.ts.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @addfox/common
|
|
3
|
+
* Shared utilities and types for Addfox packages
|
|
4
|
+
*/
|
|
5
|
+
export * from './logger/index.js';
|
|
6
|
+
export * from './errors/index.js';
|
|
7
|
+
export * from './utils/index.js';
|
|
8
|
+
export type { ILogger, Logger, Result, ValidationResult, ValidationError, ValidationWarning, CacheEntry, Strategy, Builder, Resolver, Middleware, Pipeline, } from './interfaces/index.js';
|
|
9
|
+
export * from './hooks/index.js';
|
|
10
|
+
export * from './webExtStdoutOrigin.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EACV,OAAO,EACP,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAG/B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
/** Logger interface (base interface for logging) */
|
|
5
|
+
export interface ILogger {
|
|
6
|
+
debug(message: string, ...args: unknown[]): void;
|
|
7
|
+
info(message: string, ...args: unknown[]): void;
|
|
8
|
+
warn(message: string, ...args: unknown[]): void;
|
|
9
|
+
error(message: string, ...args: unknown[]): void;
|
|
10
|
+
}
|
|
11
|
+
/** @deprecated Use ILogger instead */
|
|
12
|
+
export type Logger = ILogger;
|
|
13
|
+
/** Result type for operations that can fail */
|
|
14
|
+
export interface Result<T, E = Error> {
|
|
15
|
+
success: boolean;
|
|
16
|
+
data?: T;
|
|
17
|
+
error?: E;
|
|
18
|
+
}
|
|
19
|
+
/** Validation result */
|
|
20
|
+
export interface ValidationResult {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
errors: ValidationError[];
|
|
23
|
+
warnings: ValidationWarning[];
|
|
24
|
+
}
|
|
25
|
+
/** Validation error */
|
|
26
|
+
export interface ValidationError {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Validation warning */
|
|
32
|
+
export interface ValidationWarning {
|
|
33
|
+
code: string;
|
|
34
|
+
message: string;
|
|
35
|
+
path?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Cache entry */
|
|
38
|
+
export interface CacheEntry<T> {
|
|
39
|
+
value: T;
|
|
40
|
+
expiresAt?: number;
|
|
41
|
+
}
|
|
42
|
+
/** Strategy pattern interface */
|
|
43
|
+
export interface Strategy<TInput, TOutput> {
|
|
44
|
+
name: string;
|
|
45
|
+
execute(input: TInput): TOutput | Promise<TOutput>;
|
|
46
|
+
canExecute(input: TInput): boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Builder function type */
|
|
49
|
+
export type Builder<TInput, TOutput, TContext = unknown> = (input: TInput, context: TContext) => TOutput | Promise<TOutput>;
|
|
50
|
+
/** Resolver function type */
|
|
51
|
+
export type Resolver<TInput, TOutput> = (input: TInput) => TOutput | Promise<TOutput>;
|
|
52
|
+
/** Middleware function type */
|
|
53
|
+
export type Middleware<T> = (value: T, next: () => T | Promise<T>) => T | Promise<T>;
|
|
54
|
+
/** Pipeline function type */
|
|
55
|
+
export type Pipeline<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oDAAoD;AACpD,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC;AAE7B,+CAA+C;AAC/C,MAAM,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,CAAC,CAAC;CACX;AAED,wBAAwB;AACxB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;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AAC,CAAC;AAErF,6BAA6B;AAC7B,MAAM,MAAM,QAAQ,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @addfox/common/logger
|
|
3
|
+
* Unified logging system with configurable output format
|
|
4
|
+
*/
|
|
5
|
+
/** Log level enumeration */
|
|
6
|
+
export type LogLevel = "info" | "success" | "warn" | "error" | "debug";
|
|
7
|
+
/** Output stream type */
|
|
8
|
+
export type LogStream = "stdout" | "stderr";
|
|
9
|
+
/** Log entry structure */
|
|
10
|
+
export interface LogEntry {
|
|
11
|
+
level: LogLevel;
|
|
12
|
+
message: string;
|
|
13
|
+
timestamp?: Date;
|
|
14
|
+
metadata?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/** Logger configuration options */
|
|
17
|
+
export interface LoggerOptions {
|
|
18
|
+
/** Output prefix (default: "[Addfox]") */
|
|
19
|
+
prefix?: string;
|
|
20
|
+
/** Whether to include timestamp */
|
|
21
|
+
showTimestamp?: boolean;
|
|
22
|
+
/** Whether to enable colors */
|
|
23
|
+
useColors?: boolean;
|
|
24
|
+
/** Custom stream writes for testing */
|
|
25
|
+
rawWrites?: {
|
|
26
|
+
stdout: WriteFn;
|
|
27
|
+
stderr: WriteFn;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
/** Write function type */
|
|
31
|
+
export type WriteFn = NodeJS.WriteStream["write"];
|
|
32
|
+
/** Base shape for entry rows: name + script path (shared by EntryTableRow, EntryInfo) */
|
|
33
|
+
export interface EntryRowBase {
|
|
34
|
+
name: string;
|
|
35
|
+
scriptPath: string;
|
|
36
|
+
}
|
|
37
|
+
/** Table row for entries display */
|
|
38
|
+
export type EntryTableRow = EntryRowBase;
|
|
39
|
+
/** Options for logEntriesTable */
|
|
40
|
+
export interface LogEntriesTableOptions {
|
|
41
|
+
root?: string;
|
|
42
|
+
}
|
|
43
|
+
/** ANSI color codes for terminal output styling */
|
|
44
|
+
export declare const ANSI_COLORS: {
|
|
45
|
+
/** Orange (256 color 208) for prefix */
|
|
46
|
+
readonly ORANGE: "\u001B[38;5;208m";
|
|
47
|
+
/** Bold + green for Done messages */
|
|
48
|
+
readonly DONE: "\u001B[1m\u001B[32m";
|
|
49
|
+
/** Dim gray for time suffix */
|
|
50
|
+
readonly TIME: "\u001B[38;5;245m";
|
|
51
|
+
/** Cyan for size/value highlight */
|
|
52
|
+
readonly VALUE: "\u001B[38;5;75m";
|
|
53
|
+
/** Purple for table headers */
|
|
54
|
+
readonly PURPLE: "\u001B[38;5;141m";
|
|
55
|
+
/** Red background + yellow text for error badge */
|
|
56
|
+
readonly ERROR_BADGE: "\u001B[41m\u001B[93m";
|
|
57
|
+
/** Red foreground for error content */
|
|
58
|
+
readonly RED: "\u001B[31m";
|
|
59
|
+
/** Reset all styles */
|
|
60
|
+
readonly RESET: "\u001B[0m";
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Unified Logger class for Addfox
|
|
64
|
+
*
|
|
65
|
+
* Provides consistent output format with:
|
|
66
|
+
* - Colored prefix ([Addfox])
|
|
67
|
+
* - Multiple log levels
|
|
68
|
+
* - Table formatting for entries
|
|
69
|
+
* - Configurable output streams
|
|
70
|
+
*/
|
|
71
|
+
export declare class Logger {
|
|
72
|
+
private prefix;
|
|
73
|
+
private showTimestamp;
|
|
74
|
+
private useColors;
|
|
75
|
+
private rawWrites;
|
|
76
|
+
constructor(options?: LoggerOptions);
|
|
77
|
+
/**
|
|
78
|
+
* Set raw stdout/stderr write functions for testing
|
|
79
|
+
*/
|
|
80
|
+
setRawWrites(writes: {
|
|
81
|
+
stdout: WriteFn;
|
|
82
|
+
stderr: WriteFn;
|
|
83
|
+
} | null): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get current write functions
|
|
86
|
+
*/
|
|
87
|
+
private getWrites;
|
|
88
|
+
/**
|
|
89
|
+
* Format the prefix with ANSI colors
|
|
90
|
+
*/
|
|
91
|
+
private formatPrefix;
|
|
92
|
+
/**
|
|
93
|
+
* Format timestamp if enabled
|
|
94
|
+
*/
|
|
95
|
+
private formatTimestamp;
|
|
96
|
+
/**
|
|
97
|
+
* Write lines to stream with prefix
|
|
98
|
+
*/
|
|
99
|
+
private writeLines;
|
|
100
|
+
/**
|
|
101
|
+
* Log general information
|
|
102
|
+
*/
|
|
103
|
+
info(...args: unknown[]): void;
|
|
104
|
+
/**
|
|
105
|
+
* Alias for info - general log
|
|
106
|
+
*/
|
|
107
|
+
log(...args: unknown[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Log success message with Done prefix
|
|
110
|
+
*/
|
|
111
|
+
success(...args: unknown[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Log success with a highlighted value (e.g., file size)
|
|
114
|
+
*/
|
|
115
|
+
successWithValue(label: string, value: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Log success with duration
|
|
118
|
+
*/
|
|
119
|
+
successWithDuration(message: string, ms: number): void;
|
|
120
|
+
/**
|
|
121
|
+
* Log warning to stderr
|
|
122
|
+
*/
|
|
123
|
+
warn(...args: unknown[]): void;
|
|
124
|
+
/**
|
|
125
|
+
* Log error (with error badge, no prefix)
|
|
126
|
+
*/
|
|
127
|
+
error(...args: unknown[]): void;
|
|
128
|
+
/**
|
|
129
|
+
* Write extension error block (for detailed error display)
|
|
130
|
+
*/
|
|
131
|
+
writeErrorBlock(lines: string[]): void;
|
|
132
|
+
/**
|
|
133
|
+
* Format duration: >= 1000ms as "X.XXs", else "Xms"
|
|
134
|
+
*/
|
|
135
|
+
formatDuration(ms: number): string;
|
|
136
|
+
/**
|
|
137
|
+
* Log entries table
|
|
138
|
+
*/
|
|
139
|
+
logEntriesTable(entries: EntryTableRow[], options?: LogEntriesTableOptions): void;
|
|
140
|
+
/**
|
|
141
|
+
* Create OSC 8 hyperlink
|
|
142
|
+
*/
|
|
143
|
+
private fileLink;
|
|
144
|
+
}
|
|
145
|
+
/** Default logger instance */
|
|
146
|
+
export declare const logger: Logger;
|
|
147
|
+
/** Log to stdout with [Addfox] prefix */
|
|
148
|
+
export declare function log(...args: unknown[]): void;
|
|
149
|
+
/** Log a completion step: [Addfox] + green "Done " + message */
|
|
150
|
+
export declare function logDone(...args: unknown[]): void;
|
|
151
|
+
/** Log a completion step with duration */
|
|
152
|
+
export declare function logDoneTimed(message: string, ms: number): void;
|
|
153
|
+
/** Log a completion step with a highlighted value */
|
|
154
|
+
export declare function logDoneWithValue(label: string, value: string): void;
|
|
155
|
+
/** Format duration helper */
|
|
156
|
+
export declare function formatDuration(ms: number): string;
|
|
157
|
+
/** Warn to stderr with [Addfox] prefix */
|
|
158
|
+
export declare function warn(...args: unknown[]): void;
|
|
159
|
+
/** Error to stderr (with error badge, no prefix) */
|
|
160
|
+
export declare function error(...args: unknown[]): void;
|
|
161
|
+
/** Write error block for extension errors */
|
|
162
|
+
export declare function writeExtensionErrorBlock(lines: string[]): void;
|
|
163
|
+
/** Log entries table */
|
|
164
|
+
export declare function logEntriesTable(entries: EntryTableRow[], options?: LogEntriesTableOptions): void;
|
|
165
|
+
/** Set raw writes for testing (e.g. capture stdout/stderr in unit tests). */
|
|
166
|
+
export declare function setAddfoxLoggerRawWrites(writes: {
|
|
167
|
+
stdout: WriteFn;
|
|
168
|
+
stderr: WriteFn;
|
|
169
|
+
} | null): void;
|
|
170
|
+
export type { Table } from "cli-table3";
|
|
171
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,4BAA4B;AAC5B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvE,yBAAyB;AACzB,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG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,EAAE,GAAG,IAAI,CAE5C;AAED,gEAAgE;AAChE,wBAAgB,OAAO,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEhD;AAED,0CAA0C;AAC1C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE9D;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,6BAA6B;AAC7B,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,0CAA0C;AAC1C,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE7C;AAED,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE9C;AAED,6CAA6C;AAC7C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAE9D;AAED,wBAAwB;AACxB,wBAAgB,eAAe,CAC7B,OAAO,EAAE,aAAa,EAAE,EACxB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,IAAI,CAEN;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CACtC,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAClD,IAAI,CAEN;AAGD,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Simple memory cache
|
|
6
|
+
*/
|
|
7
|
+
export interface Cache<T> {
|
|
8
|
+
get(key: string): T | undefined;
|
|
9
|
+
set(key: string, value: T, ttlMs?: number): void;
|
|
10
|
+
has(key: string): boolean;
|
|
11
|
+
delete(key: string): boolean;
|
|
12
|
+
clear(): void;
|
|
13
|
+
keys(): string[];
|
|
14
|
+
size(): number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a memory cache
|
|
18
|
+
*/
|
|
19
|
+
export declare function createCache<T>(): Cache<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Memoize a function
|
|
22
|
+
*/
|
|
23
|
+
export declare function memoize<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
|
|
24
|
+
/**
|
|
25
|
+
* Memoize an async function
|
|
26
|
+
*/
|
|
27
|
+
export declare function memoizeAsync<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, keyFn?: (...args: TArgs) => string): (...args: TArgs) => Promise<TReturn>;
|
|
28
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/utils/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,IAAI,IAAI,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CA6DzC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EACtD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,EAC/B,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,MAAM,GACjC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAc7B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EAC3D,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EACxC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,MAAM,GACjC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CA4BtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Deep merge objects
|
|
6
|
+
*/
|
|
7
|
+
export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
|
|
8
|
+
/**
|
|
9
|
+
* Pick properties from object
|
|
10
|
+
*/
|
|
11
|
+
export declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
12
|
+
/**
|
|
13
|
+
* Omit properties from object
|
|
14
|
+
*/
|
|
15
|
+
export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
16
|
+
/**
|
|
17
|
+
* Get nested property value
|
|
18
|
+
*/
|
|
19
|
+
export declare function get<T>(obj: unknown, path: string, defaultValue?: T): T | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Set nested property value
|
|
22
|
+
*/
|
|
23
|
+
export declare function set<T extends Record<string, unknown>>(obj: T, path: string, value: unknown): T;
|
|
24
|
+
/**
|
|
25
|
+
* Check if object has property
|
|
26
|
+
*/
|
|
27
|
+
export declare function has(obj: unknown, path: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Flatten object
|
|
30
|
+
*/
|
|
31
|
+
export declare function flatten(obj: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Unflatten object
|
|
34
|
+
*/
|
|
35
|
+
export declare function unflatten(obj: Record<string, unknown>): Record<string, unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Filter object by predicate
|
|
38
|
+
*/
|
|
39
|
+
export declare function filter<T extends Record<string, unknown>>(obj: T, predicate: (key: string, value: unknown) => boolean): Partial<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Map object values
|
|
42
|
+
*/
|
|
43
|
+
export declare function mapValues<T extends Record<string, unknown>, U>(obj: T, fn: (value: T[keyof T], key: string) => U): Record<keyof T, U>;
|
|
44
|
+
/**
|
|
45
|
+
* Check if value is plain object
|
|
46
|
+
*/
|
|
47
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if value is empty
|
|
50
|
+
*/
|
|
51
|
+
export declare function isEmpty(value: unknown): boolean;
|
|
52
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/utils/object.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,C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,MAAM,EAAE,OAAO,CAAC,EACtD,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,GAClD,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAC5D,GAAG,EAAE,CAAC,EACN,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GACxC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAQpB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO9E;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAc/C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline utilities for composing functions
|
|
3
|
+
*/
|
|
4
|
+
import type { Pipeline, Middleware } from '../interfaces/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compose functions left to right
|
|
7
|
+
*/
|
|
8
|
+
export declare function pipe<T>(...fns: Array<(x: T) => T>): (x: T) => T;
|
|
9
|
+
/**
|
|
10
|
+
* Compose async functions left to right
|
|
11
|
+
*/
|
|
12
|
+
export declare function pipeAsync<T>(...fns: Array<(x: T) => T | Promise<T>>): (x: T) => Promise<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Compose functions right to left
|
|
15
|
+
*/
|
|
16
|
+
export declare function compose<T>(...fns: Array<(x: T) => T>): (x: T) => T;
|
|
17
|
+
/**
|
|
18
|
+
* Create a pipeline from steps
|
|
19
|
+
*/
|
|
20
|
+
export declare function createPipeline<TInput, TOutput>(...steps: Array<(input: TInput | TOutput) => TOutput | Promise<TOutput>>): Pipeline<TInput, TOutput>;
|
|
21
|
+
/**
|
|
22
|
+
* Apply middleware chain
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyMiddleware<T>(value: T, middlewares: Middleware<T>[]): T | Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Curry a function
|
|
27
|
+
*/
|
|
28
|
+
export declare function curry<T1, T2, T3>(fn: (a: T1, b: T2) => T3): (a: T1) => (b: T2) => T3;
|
|
29
|
+
/**
|
|
30
|
+
* Partial application
|
|
31
|
+
*/
|
|
32
|
+
export declare function partial<T1, T2 extends unknown[], TReturn>(fn: (a: T1, ...rest: T2) => TReturn, a: T1): (...rest: T2) => TReturn;
|
|
33
|
+
/**
|
|
34
|
+
* Tap - execute side effect and return original value
|
|
35
|
+
*/
|
|
36
|
+
export declare function tap<T>(fn: (x: T) => void): (x: T) => T;
|
|
37
|
+
/**
|
|
38
|
+
* Try catch wrapper
|
|
39
|
+
*/
|
|
40
|
+
export declare function tryCatch<T, E = Error>(fn: () => T, onError?: (error: E) => T): T | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Async try catch wrapper
|
|
43
|
+
*/
|
|
44
|
+
export declare function tryCatchAsync<T, E = Error>(fn: () => Promise<T>, onError?: (error: E) => T | Promise<T>): Promise<T | undefined>;
|
|
45
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/utils/pipeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAE/D;AAED;;GAEG;A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AAO,CAE1B;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAKtD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EACnC,EAAE,EAAE,MAAM,CAAC,EACX,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GACxB,CAAC,GAAG,SAAS,CAMf;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAC9C,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACrC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAMxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webExtStdoutOrigin.d.ts","sourceRoot":"","sources":["../../src/webExtStdoutOrigin.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @addfox/common/errors
|
|
3
|
+
* Unified error system with error codes and formatting
|
|
4
|
+
*/
|
|
5
|
+
export declare const ADDFOX_ERROR_CODES: {
|
|
6
|
+
readonly CONFIG_NOT_FOUND: "ADDFOX_CONFIG_NOT_FOUND";
|
|
7
|
+
readonly CONFIG_LOAD_FAILED: "ADDFOX_CONFIG_LOAD_FAILED";
|
|
8
|
+
readonly MANIFEST_MISSING: "ADDFOX_MANIFEST_MISSING";
|
|
9
|
+
readonly APP_DIR_MISSING: "ADDFOX_APP_DIR_MISSING";
|
|
10
|
+
readonly NO_ENTRIES: "ADDFOX_NO_ENTRIES";
|
|
11
|
+
readonly ENTRY_SCRIPT_FROM_HTML: "ADDFOX_ENTRY_SCRIPT_FROM_HTML";
|
|
12
|
+
readonly INVALID_BROWSER: "ADDFOX_INVALID_BROWSER";
|
|
13
|
+
readonly UNKNOWN_COMMAND: "ADDFOX_UNKNOWN_COMMAND";
|
|
14
|
+
readonly RSTEST_CONFIG_NOT_FOUND: "ADDFOX_RSTEST_CONFIG_NOT_FOUND";
|
|
15
|
+
readonly RSDOCTOR_NOT_INSTALLED: "ADDFOX_RSDOCTOR_NOT_INSTALLED";
|
|
16
|
+
readonly RSBUILD_CONFIG_ERROR: "ADDFOX_RSBUILD_CONFIG_ERROR";
|
|
17
|
+
readonly BUILD_ERROR: "ADDFOX_BUILD_ERROR";
|
|
18
|
+
readonly ZIP_OUTPUT: "ADDFOX_ZIP_OUTPUT";
|
|
19
|
+
readonly ZIP_ARCHIVE: "ADDFOX_ZIP_ARCHIVE";
|
|
20
|
+
};
|
|
21
|
+
export type AddfoxErrorCode = (typeof ADDFOX_ERROR_CODES)[keyof typeof ADDFOX_ERROR_CODES];
|
|
22
|
+
export interface ErrorOptions {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
details?: string;
|
|
26
|
+
hint?: string;
|
|
27
|
+
cause?: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface ErrorJSON {
|
|
30
|
+
name: string;
|
|
31
|
+
code: string;
|
|
32
|
+
message: string;
|
|
33
|
+
details?: string;
|
|
34
|
+
hint?: string;
|
|
35
|
+
stack?: string;
|
|
36
|
+
cause?: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Addfox base error class
|
|
40
|
+
*
|
|
41
|
+
* Provides:
|
|
42
|
+
* - Error code for programmatic handling
|
|
43
|
+
* - Details and hint for user guidance
|
|
44
|
+
* - JSON serialization
|
|
45
|
+
* - Formatted string output
|
|
46
|
+
*/
|
|
47
|
+
export declare class AddfoxError extends Error {
|
|
48
|
+
readonly code: string;
|
|
49
|
+
readonly details?: string;
|
|
50
|
+
readonly hint?: string;
|
|
51
|
+
readonly cause?: unknown;
|
|
52
|
+
constructor(options: ErrorOptions);
|
|
53
|
+
/**
|
|
54
|
+
* Serialize error to JSON
|
|
55
|
+
*/
|
|
56
|
+
toJSON(): ErrorJSON;
|
|
57
|
+
/**
|
|
58
|
+
* Format error for display
|
|
59
|
+
*/
|
|
60
|
+
format(): string;
|
|
61
|
+
/**
|
|
62
|
+
* String representation
|
|
63
|
+
*/
|
|
64
|
+
toString(): string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a generic AddfoxError
|
|
68
|
+
*/
|
|
69
|
+
export declare function createError(code: string, message: string, options?: Omit<ErrorOptions, "code" | "message">): AddfoxError;
|
|
70
|
+
/**
|
|
71
|
+
* Check if value is an AddfoxError
|
|
72
|
+
*/
|
|
73
|
+
export declare function isAddfoxError(error: unknown): error is AddfoxError;
|
|
74
|
+
/**
|
|
75
|
+
* Format any error for display
|
|
76
|
+
*/
|
|
77
|
+
export declare function formatError(error: unknown): string;
|
|
78
|
+
/**
|
|
79
|
+
* Print error to stderr and exit process.
|
|
80
|
+
* Used in CLI top-level catch for clear error reporting.
|
|
81
|
+
*
|
|
82
|
+
* Note: This function should be called from CLI only, as it exits the process.
|
|
83
|
+
* The error display is handled by the caller (CLI) using logger.error().
|
|
84
|
+
*/
|
|
85
|
+
export declare function exitWithError(_err: unknown, exitCode?: number): never;
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAerB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MA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AAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,SAAI,GAAG,KAAK,CAIhE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { HookFunction, HookPhase, HookManagerOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generic hook manager - allows users to define their own stages
|
|
4
|
+
* Only provides before/after hooks for additional code execution
|
|
5
|
+
*/
|
|
6
|
+
export declare class HookManager<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
7
|
+
private registry;
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options?: HookManagerOptions);
|
|
10
|
+
/**
|
|
11
|
+
* Register a hook for a specific stage and phase
|
|
12
|
+
* @param stage - The stage name (user-defined)
|
|
13
|
+
* @param phase - 'before' or 'after'
|
|
14
|
+
* @param handler - The hook function
|
|
15
|
+
* @returns Unregister function
|
|
16
|
+
*/
|
|
17
|
+
register<K extends keyof T>(stage: K, phase: HookPhase, handler: HookFunction<T[K]>): () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Execute hooks for a specific stage and phase
|
|
20
|
+
* @param stage - The stage name
|
|
21
|
+
* @param phase - 'before' or 'after'
|
|
22
|
+
* @param payload - Data passed to hooks
|
|
23
|
+
*/
|
|
24
|
+
execute<K extends keyof T>(stage: K, phase: HookPhase, payload: T[K]): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if hooks exist for a stage/phase
|
|
27
|
+
*/
|
|
28
|
+
has<K extends keyof T>(stage: K, phase: HookPhase): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get number of registered hooks for a stage/phase
|
|
31
|
+
*/
|
|
32
|
+
count<K extends keyof T>(stage: K, phase: HookPhase): number;
|
|
33
|
+
/**
|
|
34
|
+
* Clear all hooks for a stage/phase, or all hooks if no stage specified
|
|
35
|
+
*/
|
|
36
|
+
clear<K extends keyof T>(stage?: K, phase?: HookPhase): void;
|
|
37
|
+
private getKey;
|
|
38
|
+
/**
|
|
39
|
+
* Get a scoped hook manager for a specific stage
|
|
40
|
+
*/
|
|
41
|
+
for<K extends keyof T>(stage: K): StageHookManager<T, K>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Scoped hook manager for a specific stage
|
|
45
|
+
*/
|
|
46
|
+
export declare class StageHookManager<T extends Record<string, unknown>, K extends keyof T> {
|
|
47
|
+
private manager;
|
|
48
|
+
private stage;
|
|
49
|
+
constructor(manager: HookManager<T>, stage: K);
|
|
50
|
+
/**
|
|
51
|
+
* Register a 'before' hook
|
|
52
|
+
*/
|
|
53
|
+
before(handler: HookFunction<T[K]>): () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Register an 'after' hook
|
|
56
|
+
*/
|
|
57
|
+
after(handler: HookFunction<T[K]>): () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Execute 'before' hooks
|
|
60
|
+
*/
|
|
61
|
+
runBefore(payload: T[K]): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Execute 'after' hooks
|
|
64
|
+
*/
|
|
65
|
+
runAfter(payload: T[K]): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=HookManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HookManager.d.ts","sourceRoot":"","sources":["../../../src/hooks/HookManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClF,OAAO,CAAC,QAAQ,CAAmD;IACnE,OAAO,CAAC,OAAO,CAAqB;gBAExB,OAAO,GAAE,kBAAuB;IAQ5C;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,EACxB,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,SAAS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AS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic hook system - allows users to define their own stages
|
|
3
|
+
* Provides only before/after hooks for additional code execution
|
|
4
|
+
*/
|
|
5
|
+
export { HookManager, StageHookManager } from './HookManager.js';
|
|
6
|
+
export type { HookFunction, HookRegistry, HookPhase, HookDescriptor, HookManagerOptions, } from './types.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook types for the generic hook system
|
|
3
|
+
*/
|
|
4
|
+
/** Base hook function type */
|
|
5
|
+
export type HookFunction<T = void> = T extends void ? () => void | Promise<void> : (payload: T) => void | Promise<void>;
|
|
6
|
+
/** Hook registry - stores hooks by name */
|
|
7
|
+
export type HookRegistry<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
8
|
+
[K in keyof T]?: Array<HookFunction<T[K]>>;
|
|
9
|
+
};
|
|
10
|
+
/** Hook phase types */
|
|
11
|
+
export type HookPhase = 'before' | 'after';
|
|
12
|
+
/** Hook descriptor */
|
|
13
|
+
export interface HookDescriptor<T = unknown> {
|
|
14
|
+
name: string;
|
|
15
|
+
phase: HookPhase;
|
|
16
|
+
handler: HookFunction<T>;
|
|
17
|
+
priority?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Hook manager options */
|
|
20
|
+
export interface HookManagerOptions {
|
|
21
|
+
/** Whether to run hooks in parallel (default: false - sequential) */
|
|
22
|
+
parallel?: boolean;
|
|
23
|
+
/** Whether to stop on first error (default: false) */
|
|
24
|
+
bail?: boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,8BAA8B;AAC9B,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,GAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC1B,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzC,2CAA2C;AAC3C,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACrF,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEF,uBAAuB;AACvB,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3C,sBAAsB;AACtB,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2BAA2B;AAC3B,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @addfox/common
|
|
3
|
+
* Shared utilities and types for Addfox packages
|
|
4
|
+
*/
|
|
5
|
+
export * from './logger/index.js';
|
|
6
|
+
export * from './errors/index.js';
|
|
7
|
+
export * from './utils/index.js';
|
|
8
|
+
export type { ILogger, Logger, Result, ValidationResult, ValidationError, ValidationWarning, CacheEntry, Strategy, Builder, Resolver, Middleware, Pipeline, } from './interfaces/index.js';
|
|
9
|
+
export * from './hooks/index.js';
|
|
10
|
+
export * from './webExtStdoutOrigin.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EACV,OAAO,EACP,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAG/B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC"}
|