modestbench 0.7.0 → 0.9.0
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/CHANGELOG.md +25 -0
- package/README.md +37 -4
- package/dist/adapters/types.d.cts +1 -1
- package/dist/adapters/types.d.cts.map +1 -1
- package/dist/adapters/types.d.ts +1 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cli/commands/run.cjs +93 -49
- package/dist/cli/commands/run.cjs.map +1 -1
- package/dist/cli/commands/run.d.cts +1 -0
- package/dist/cli/commands/run.d.cts.map +1 -1
- package/dist/cli/commands/run.d.ts +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +95 -51
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/index.cjs +7 -1
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +7 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/{core → config}/benchmark-schema.cjs +1 -1
- package/dist/config/benchmark-schema.cjs.map +1 -0
- package/dist/config/benchmark-schema.d.cts +913 -0
- package/dist/config/benchmark-schema.d.cts.map +1 -0
- package/dist/config/benchmark-schema.d.ts +913 -0
- package/dist/config/benchmark-schema.d.ts.map +1 -0
- package/dist/{core → config}/benchmark-schema.js +1 -1
- package/dist/config/benchmark-schema.js.map +1 -0
- package/dist/config/schema.cjs +188 -105
- package/dist/config/schema.cjs.map +1 -1
- package/dist/config/schema.d.cts +208 -80
- package/dist/config/schema.d.cts.map +1 -1
- package/dist/config/schema.d.ts +208 -80
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +187 -104
- package/dist/config/schema.js.map +1 -1
- package/dist/constants.cjs +2 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +2 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/engine.cjs +50 -45
- package/dist/core/engine.cjs.map +1 -1
- package/dist/core/engine.d.cts.map +1 -1
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/engine.js +50 -45
- package/dist/core/engine.js.map +1 -1
- package/dist/core/output-path-resolver.cjs +15 -1
- package/dist/core/output-path-resolver.cjs.map +1 -1
- package/dist/core/output-path-resolver.d.cts +8 -0
- package/dist/core/output-path-resolver.d.cts.map +1 -1
- package/dist/core/output-path-resolver.d.ts +8 -0
- package/dist/core/output-path-resolver.d.ts.map +1 -1
- package/dist/core/output-path-resolver.js +13 -0
- package/dist/core/output-path-resolver.js.map +1 -1
- package/dist/errors/index.cjs +3 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +1 -1
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/reporter.cjs +45 -1
- package/dist/errors/reporter.cjs.map +1 -1
- package/dist/errors/reporter.d.cts +32 -0
- package/dist/errors/reporter.d.cts.map +1 -1
- package/dist/errors/reporter.d.ts +32 -0
- package/dist/errors/reporter.d.ts.map +1 -1
- package/dist/errors/reporter.js +42 -0
- package/dist/errors/reporter.js.map +1 -1
- package/dist/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/reporters/json.cjs +1 -1
- package/dist/reporters/json.cjs.map +1 -1
- package/dist/reporters/json.js +1 -1
- package/dist/reporters/json.js.map +1 -1
- package/dist/schema/modestbench-config.schema.json +94 -87
- package/dist/services/budget-evaluator.cjs +8 -6
- package/dist/services/budget-evaluator.cjs.map +1 -1
- package/dist/services/budget-evaluator.d.cts +2 -2
- package/dist/services/budget-evaluator.d.cts.map +1 -1
- package/dist/services/budget-evaluator.d.ts +2 -2
- package/dist/services/budget-evaluator.d.ts.map +1 -1
- package/dist/services/budget-evaluator.js +8 -6
- package/dist/services/budget-evaluator.js.map +1 -1
- package/dist/services/budget-resolver.cjs +214 -0
- package/dist/services/budget-resolver.cjs.map +1 -0
- package/dist/services/budget-resolver.d.cts +98 -0
- package/dist/services/budget-resolver.d.cts.map +1 -0
- package/dist/services/budget-resolver.d.ts +98 -0
- package/dist/services/budget-resolver.d.ts.map +1 -0
- package/dist/services/budget-resolver.js +203 -0
- package/dist/services/budget-resolver.js.map +1 -0
- package/dist/services/file-loader.cjs +1 -1
- package/dist/services/file-loader.cjs.map +1 -1
- package/dist/services/file-loader.js +1 -1
- package/dist/services/file-loader.js.map +1 -1
- package/dist/services/reporter-loader.cjs +281 -0
- package/dist/services/reporter-loader.cjs.map +1 -0
- package/dist/services/reporter-loader.d.cts +67 -0
- package/dist/services/reporter-loader.d.cts.map +1 -0
- package/dist/services/reporter-loader.d.ts +67 -0
- package/dist/services/reporter-loader.d.ts.map +1 -0
- package/dist/services/reporter-loader.js +241 -0
- package/dist/services/reporter-loader.js.map +1 -0
- package/dist/types/budgets.d.cts +31 -0
- package/dist/types/budgets.d.cts.map +1 -1
- package/dist/types/budgets.d.ts +31 -0
- package/dist/types/budgets.d.ts.map +1 -1
- package/dist/types/core.cjs.map +1 -1
- package/dist/types/core.d.cts +28 -75
- package/dist/types/core.d.cts.map +1 -1
- package/dist/types/core.d.ts +28 -75
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/plugin.cjs +9 -0
- package/dist/types/plugin.cjs.map +1 -0
- package/dist/types/plugin.d.cts +179 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.ts +179 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +8 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/utils/package.cjs +66 -5
- package/dist/utils/package.cjs.map +1 -1
- package/dist/utils/package.d.cts +6 -0
- package/dist/utils/package.d.cts.map +1 -1
- package/dist/utils/package.d.ts +6 -0
- package/dist/utils/package.d.ts.map +1 -1
- package/dist/utils/package.js +31 -1
- package/dist/utils/package.js.map +1 -1
- package/dist/utils/reporter-utils.cjs +90 -0
- package/dist/utils/reporter-utils.cjs.map +1 -0
- package/dist/utils/reporter-utils.d.cts +42 -0
- package/dist/utils/reporter-utils.d.cts.map +1 -0
- package/dist/utils/reporter-utils.d.ts +42 -0
- package/dist/utils/reporter-utils.d.ts.map +1 -0
- package/dist/utils/reporter-utils.js +83 -0
- package/dist/utils/reporter-utils.js.map +1 -0
- package/package.json +20 -9
- package/src/adapters/types.ts +1 -1
- package/src/cli/commands/run.ts +140 -69
- package/src/cli/index.ts +8 -1
- package/src/{core → config}/benchmark-schema.ts +1 -1
- package/src/config/schema.ts +379 -302
- package/src/constants.ts +2 -0
- package/src/core/engine.ts +74 -69
- package/src/core/output-path-resolver.ts +14 -0
- package/src/errors/index.ts +2 -0
- package/src/errors/reporter.ts +55 -0
- package/src/index.ts +19 -1
- package/src/reporters/json.ts +1 -1
- package/src/services/budget-evaluator.ts +13 -9
- package/src/services/budget-resolver.ts +254 -0
- package/src/services/file-loader.ts +1 -1
- package/src/services/reporter-loader.ts +323 -0
- package/src/types/budgets.ts +38 -0
- package/src/types/core.ts +64 -99
- package/src/types/index.ts +3 -0
- package/src/types/plugin.ts +197 -0
- package/src/utils/package.ts +32 -1
- package/src/utils/reporter-utils.ts +85 -0
- package/dist/core/benchmark-schema.cjs.map +0 -1
- package/dist/core/benchmark-schema.d.cts +0 -139
- package/dist/core/benchmark-schema.d.cts.map +0 -1
- package/dist/core/benchmark-schema.d.ts +0 -139
- package/dist/core/benchmark-schema.d.ts.map +0 -1
- package/dist/core/benchmark-schema.js.map +0 -1
package/dist/types/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { jsonReporterConfigSchema, ModestBenchConfig, ModestBenchConfigInput, reporterConfigSchema } from "../config/schema.js";
|
|
3
|
+
import type { AbsoluteBudget, BaselineReference, BaselineStorage, BaselineSummaryData, Budget, BudgetPattern, BudgetResult, BudgetSummary, BudgetViolation, RelativeBudget, ResolvedBudgets, RunId, TaskId } from "./budgets.js";
|
|
4
4
|
/**
|
|
5
5
|
* Benchmark file structure after parsing
|
|
6
6
|
*/
|
|
@@ -14,18 +14,6 @@ export interface BenchmarkFile {
|
|
|
14
14
|
/** File metadata */
|
|
15
15
|
readonly metadata: FileMetadata;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* ModestBench Core Types
|
|
19
|
-
*
|
|
20
|
-
* Defines the fundamental data structures used throughout the ModestBench
|
|
21
|
-
* system. These types represent benchmark results, metadata, configuration, and
|
|
22
|
-
* system state.
|
|
23
|
-
*
|
|
24
|
-
* Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
|
|
25
|
-
* derived from Zod schemas and re-exported from benchmark-schema.ts for type
|
|
26
|
-
* safety and consistency.
|
|
27
|
-
*/
|
|
28
|
-
export { createRunId, createTaskId } from "../utils/identifiers.js";
|
|
29
17
|
/**
|
|
30
18
|
* Represents a complete benchmark run across multiple files
|
|
31
19
|
*/
|
|
@@ -57,6 +45,9 @@ export interface BenchmarkRun {
|
|
|
57
45
|
/** Run-level tags */
|
|
58
46
|
readonly tags?: string[];
|
|
59
47
|
}
|
|
48
|
+
export type { AbsoluteBudget, BaselineReference, BaselineStorage, BaselineSummaryData, Budget, BudgetPattern, BudgetResult, BudgetSummary, BudgetViolation, RelativeBudget, ResolvedBudgets, RunId, TaskId, };
|
|
49
|
+
export type { ModestBenchConfig, ModestBenchConfigInput };
|
|
50
|
+
export type { BenchmarkDefinition, BenchmarkDefinitionInput, BenchmarkSuite, BenchmarkSuiteInput, BenchmarkTask, BenchmarkTaskInput, } from "../config/benchmark-schema.js";
|
|
60
51
|
/**
|
|
61
52
|
* CI/CD environment information
|
|
62
53
|
*/
|
|
@@ -74,6 +65,18 @@ export interface CiInfo {
|
|
|
74
65
|
/** Pull request number */
|
|
75
66
|
readonly pullRequest?: string;
|
|
76
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* ModestBench Core Types
|
|
70
|
+
*
|
|
71
|
+
* Defines the fundamental data structures used throughout the ModestBench
|
|
72
|
+
* system. These types represent benchmark results, metadata, configuration, and
|
|
73
|
+
* system state.
|
|
74
|
+
*
|
|
75
|
+
* Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
|
|
76
|
+
* derived from Zod schemas and re-exported from benchmark-schema.ts for type
|
|
77
|
+
* safety and consistency.
|
|
78
|
+
*/
|
|
79
|
+
export { createRunId, createTaskId } from "../utils/identifiers.js";
|
|
77
80
|
/**
|
|
78
81
|
* CPU information
|
|
79
82
|
*/
|
|
@@ -217,6 +220,10 @@ export interface GitInfo {
|
|
|
217
220
|
/** Commit timestamp */
|
|
218
221
|
readonly timestamp: Date;
|
|
219
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Configuration options for the JSON reporter
|
|
225
|
+
*/
|
|
226
|
+
export type JsonReporterConfig = z.infer<typeof jsonReporterConfigSchema>;
|
|
220
227
|
/**
|
|
221
228
|
* Memory information
|
|
222
229
|
*/
|
|
@@ -229,68 +236,12 @@ export interface MemoryInfo {
|
|
|
229
236
|
readonly used: number;
|
|
230
237
|
}
|
|
231
238
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* The JSON Schema for this configuration is available at
|
|
235
|
-
* `dist/schema/modestbench-config.schema.json` after building the project.
|
|
236
|
-
*
|
|
237
|
-
* Config files can optionally include a `$schema` property pointing to the
|
|
238
|
-
* schema file for IDE autocomplete and validation support.
|
|
239
|
+
* Reporter-specific configuration
|
|
239
240
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* ```json
|
|
243
|
-
* {
|
|
244
|
-
* "$schema": "./node_modules/modestbench/dist/schema/modestbench-config.schema.json",
|
|
245
|
-
* "iterations": 1000,
|
|
246
|
-
* "reporters": ["human", "json"],
|
|
247
|
-
* "time": 5000
|
|
248
|
-
* }
|
|
249
|
-
* ```
|
|
241
|
+
* Provides typed configuration for known reporters. Unknown reporter configs
|
|
242
|
+
* are allowed via index signature.
|
|
250
243
|
*/
|
|
251
|
-
export
|
|
252
|
-
readonly $schema?: string | undefined;
|
|
253
|
-
/** Whether to stop on first failure */
|
|
254
|
-
readonly bail: boolean;
|
|
255
|
-
/** Name of baseline to use for relative budget comparisons */
|
|
256
|
-
readonly baseline?: string | undefined;
|
|
257
|
-
/** How to handle budget violations: 'fail', 'warn', or 'report' */
|
|
258
|
-
readonly budgetMode?: 'fail' | 'report' | 'warn' | undefined;
|
|
259
|
-
/** Performance budgets mapped by task identifier */
|
|
260
|
-
readonly budgets?: Record<string, unknown> | undefined;
|
|
261
|
-
/** Patterns to exclude from discovery */
|
|
262
|
-
readonly exclude: string[];
|
|
263
|
-
/** Tags to exclude from execution */
|
|
264
|
-
readonly excludeTags: string[];
|
|
265
|
-
/** Default number of iterations per task */
|
|
266
|
-
readonly iterations: number;
|
|
267
|
-
/** How to limit benchmark execution: 'time', 'iterations', 'any', or 'all' */
|
|
268
|
-
readonly limitBy: 'all' | 'any' | 'iterations' | 'time';
|
|
269
|
-
/** Custom metadata to attach to runs */
|
|
270
|
-
readonly metadata: Record<string, unknown>;
|
|
271
|
-
/** Output directory for reports (undefined means stdout for data reporters) */
|
|
272
|
-
readonly outputDir?: string;
|
|
273
|
-
/** Pattern(s) for discovering benchmark files */
|
|
274
|
-
readonly pattern: string | string[];
|
|
275
|
-
/** Whether to run in quiet mode */
|
|
276
|
-
readonly quiet: boolean;
|
|
277
|
-
/** Configuration for specific reporters */
|
|
278
|
-
readonly reporterConfig: Record<string, unknown>;
|
|
279
|
-
/** Reporters to use for output */
|
|
280
|
-
readonly reporters: string[];
|
|
281
|
-
/** Tags to include (if empty, include all) */
|
|
282
|
-
readonly tags: string[];
|
|
283
|
-
/** Threshold configuration for performance assertions */
|
|
284
|
-
readonly thresholds: ThresholdConfig;
|
|
285
|
-
/** Maximum time to spend on each task in milliseconds */
|
|
286
|
-
readonly time: number;
|
|
287
|
-
/** Timeout for individual tasks in milliseconds */
|
|
288
|
-
readonly timeout: number;
|
|
289
|
-
/** Whether to run in verbose mode */
|
|
290
|
-
readonly verbose: boolean;
|
|
291
|
-
/** Number of warmup iterations before measurement */
|
|
292
|
-
readonly warmup: number;
|
|
293
|
-
}
|
|
244
|
+
export type ReporterConfig = z.infer<typeof reporterConfigSchema>;
|
|
294
245
|
/**
|
|
295
246
|
* Summary statistics for a benchmark run
|
|
296
247
|
*/
|
|
@@ -376,6 +327,8 @@ export interface TaskResult {
|
|
|
376
327
|
}
|
|
377
328
|
/**
|
|
378
329
|
* Threshold configuration for performance assertions
|
|
330
|
+
*
|
|
331
|
+
* TODO: Derive from thresholdConfigSchema via z.infer (see #15)
|
|
379
332
|
*/
|
|
380
333
|
export interface ThresholdConfig {
|
|
381
334
|
/** Maximum allowed margin of error percentage */
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,sBAA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iDAAiD;IACjD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
package/dist/types/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAqHA;;;;;;;;;;GAUG;AAEH,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gCAAgC"}
|
package/dist/types/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAIH,6CAA6C;AAC7C,sCAAsD;AAA7C,sGAAA,WAAW,OAAA;AAAE,uGAAA,YAAY,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAIH,6CAA6C;AAC7C,sCAAsD;AAA7C,sGAAA,WAAW,OAAA;AAAE,uGAAA,YAAY,OAAA;AAWlC,4BAA4B;AAC5B,gDAA6B"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export type * from "./core.cjs";
|
|
8
8
|
export { createRunId, createTaskId } from "./core.cjs";
|
|
9
9
|
export type * from "./interfaces.cjs";
|
|
10
|
+
export type * from "./plugin.cjs";
|
|
10
11
|
export type * from "./profiler.cjs";
|
|
11
12
|
export * from "./utility.cjs";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,gCAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAkB;AAGtD,sCAAqC;AAGrC,oCAAmC;AAGnC,8BAA6B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,gCAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAkB;AAGtD,sCAAqC;AAGrC,kCAAiC;AAGjC,oCAAmC;AAGnC,8BAA6B"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export type * from "./core.js";
|
|
8
8
|
export { createRunId, createTaskId } from "./core.js";
|
|
9
9
|
export type * from "./interfaces.js";
|
|
10
|
+
export type * from "./plugin.js";
|
|
10
11
|
export type * from "./profiler.js";
|
|
11
12
|
export * from "./utility.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,+BAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB;AAGtD,qCAAqC;AAGrC,mCAAmC;AAGnC,6BAA6B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,+BAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB;AAGtD,qCAAqC;AAGrC,iCAAiC;AAGjC,mCAAmC;AAGnC,6BAA6B"}
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,6CAA6C;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,6CAA6C;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB;AAWtD,4BAA4B;AAC5B,6BAA6B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ModestBench Plugin Types
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for third-party reporter plugins. These types are exported
|
|
6
|
+
* from the main package for use by plugin authors.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ModestBench Plugin Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for third-party reporter plugins. These types are exported
|
|
5
|
+
* from the main package for use by plugin authors.
|
|
6
|
+
*/
|
|
7
|
+
import type { Reporter } from "./interfaces.cjs";
|
|
8
|
+
import type { Logger } from "./utility.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Class constructor for reporter plugins
|
|
11
|
+
*
|
|
12
|
+
* Plugin authors can export a default class matching this signature. The class
|
|
13
|
+
* constructor receives options from the config file and a context object with
|
|
14
|
+
* utilities.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type { Reporter, ReporterContext } from 'modestbench';
|
|
20
|
+
*
|
|
21
|
+
* interface MyReporterOptions {
|
|
22
|
+
* verbose?: boolean;
|
|
23
|
+
* outputFormat?: 'text' | 'markdown';
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* class MyReporter implements Reporter {
|
|
27
|
+
* constructor(
|
|
28
|
+
* private options: MyReporterOptions,
|
|
29
|
+
* private context: ReporterContext,
|
|
30
|
+
* ) {}
|
|
31
|
+
*
|
|
32
|
+
* onStart(run) {
|
|
33
|
+
* if (this.options.verbose) console.log('Starting');
|
|
34
|
+
* }
|
|
35
|
+
* onEnd(run) {
|
|
36
|
+
* console.log('Done');
|
|
37
|
+
* }
|
|
38
|
+
* onError(error) {
|
|
39
|
+
* console.error(error);
|
|
40
|
+
* }
|
|
41
|
+
* onTaskResult(result) {
|
|
42
|
+
* console.log(
|
|
43
|
+
* `${result.name}: ${this.context.utils.formatDuration(result.mean)}`,
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* export default MyReporter;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @typeParam TOptions - The shape of the options object (defaults to
|
|
52
|
+
* Record<string, unknown>)
|
|
53
|
+
*/
|
|
54
|
+
export interface ReporterClass<TOptions extends Record<string, unknown> = Record<string, unknown>> {
|
|
55
|
+
new (options?: TOptions, context?: ReporterContext): Reporter;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Context provided to reporter plugins
|
|
59
|
+
*
|
|
60
|
+
* Contains version information and utility functions that plugins can use.
|
|
61
|
+
*/
|
|
62
|
+
export interface ReporterContext {
|
|
63
|
+
/**
|
|
64
|
+
* Logger for reporter output
|
|
65
|
+
*
|
|
66
|
+
* Use this instead of console.log/console.error to ensure output respects the
|
|
67
|
+
* user's verbosity settings and uses the correct output streams.
|
|
68
|
+
*/
|
|
69
|
+
readonly logger: Logger;
|
|
70
|
+
/**
|
|
71
|
+
* Plugin API version
|
|
72
|
+
*
|
|
73
|
+
* Incremented when breaking changes are made to the plugin API. Currently
|
|
74
|
+
* version 1.
|
|
75
|
+
*/
|
|
76
|
+
readonly pluginApiVersion: number;
|
|
77
|
+
/**
|
|
78
|
+
* Utility functions for formatting benchmark data
|
|
79
|
+
*/
|
|
80
|
+
readonly utils: ReporterUtils;
|
|
81
|
+
/**
|
|
82
|
+
* ModestBench version
|
|
83
|
+
*
|
|
84
|
+
* Plugins can use this to check compatibility.
|
|
85
|
+
*/
|
|
86
|
+
readonly version: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Factory function for creating reporter instances
|
|
90
|
+
*
|
|
91
|
+
* Plugin authors can export a default function matching this signature. The
|
|
92
|
+
* function receives options from the config file and a context object with
|
|
93
|
+
* utilities. Use the generic parameter to define the shape of your options.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
*
|
|
97
|
+
* ```typescript
|
|
98
|
+
* import type { ReporterFactory } from 'modestbench';
|
|
99
|
+
*
|
|
100
|
+
* interface MyReporterOptions {
|
|
101
|
+
* verbose?: boolean;
|
|
102
|
+
* outputFormat?: 'text' | 'markdown';
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* const createReporter: ReporterFactory<MyReporterOptions> = (
|
|
106
|
+
* options,
|
|
107
|
+
* context,
|
|
108
|
+
* ) => {
|
|
109
|
+
* return {
|
|
110
|
+
* onStart(run) {
|
|
111
|
+
* if (options.verbose) console.log('Starting');
|
|
112
|
+
* },
|
|
113
|
+
* onEnd(run) {
|
|
114
|
+
* console.log('Done');
|
|
115
|
+
* },
|
|
116
|
+
* onError(error) {
|
|
117
|
+
* console.error(error);
|
|
118
|
+
* },
|
|
119
|
+
* onTaskResult(result) {
|
|
120
|
+
* console.log(
|
|
121
|
+
* `${result.name}: ${context.utils.formatDuration(result.mean)}`,
|
|
122
|
+
* );
|
|
123
|
+
* },
|
|
124
|
+
* };
|
|
125
|
+
* };
|
|
126
|
+
*
|
|
127
|
+
* export default createReporter;
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @typeParam TOptions - The shape of the options object (defaults to
|
|
131
|
+
* Record<string, unknown>)
|
|
132
|
+
*/
|
|
133
|
+
export type ReporterFactory<TOptions extends Record<string, unknown> = Record<string, unknown>> = (options: TOptions, context: ReporterContext) => Promise<Reporter> | Reporter;
|
|
134
|
+
/**
|
|
135
|
+
* Union type representing all valid reporter plugin exports
|
|
136
|
+
*
|
|
137
|
+
* A reporter plugin module can export:
|
|
138
|
+
*
|
|
139
|
+
* - A plain Reporter object (simplest form, no options)
|
|
140
|
+
* - A ReporterClass constructor (instantiated with options)
|
|
141
|
+
* - A ReporterFactory function (most flexible, supports async)
|
|
142
|
+
*/
|
|
143
|
+
export type ReporterPlugin = Reporter | ReporterClass | ReporterFactory;
|
|
144
|
+
/**
|
|
145
|
+
* Utility functions available to reporter plugins
|
|
146
|
+
*
|
|
147
|
+
* These functions help format benchmark data consistently.
|
|
148
|
+
*/
|
|
149
|
+
export interface ReporterUtils {
|
|
150
|
+
/**
|
|
151
|
+
* Format bytes in human-readable format
|
|
152
|
+
*
|
|
153
|
+
* @param bytes - Number of bytes
|
|
154
|
+
* @returns Formatted string (e.g., "1.5 GB", "256 MB")
|
|
155
|
+
*/
|
|
156
|
+
formatBytes(bytes: number): string;
|
|
157
|
+
/**
|
|
158
|
+
* Format duration in human-readable format
|
|
159
|
+
*
|
|
160
|
+
* @param nanoseconds - Duration in nanoseconds
|
|
161
|
+
* @returns Formatted string (e.g., "1.23ms", "456.78μs")
|
|
162
|
+
*/
|
|
163
|
+
formatDuration(nanoseconds: number): string;
|
|
164
|
+
/**
|
|
165
|
+
* Format operations per second
|
|
166
|
+
*
|
|
167
|
+
* @param opsPerSecond - Operations per second
|
|
168
|
+
* @returns Formatted string (e.g., "1.2M ops/sec", "456K ops/sec")
|
|
169
|
+
*/
|
|
170
|
+
formatOpsPerSecond(opsPerSecond: number): string;
|
|
171
|
+
/**
|
|
172
|
+
* Format percentage value
|
|
173
|
+
*
|
|
174
|
+
* @param value - Percentage value
|
|
175
|
+
* @returns Formatted string (e.g., "12.34%")
|
|
176
|
+
*/
|
|
177
|
+
formatPercentage(value: number): string;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAwB;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAqB;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,aAAa,CAC5B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAElE,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAC;CAC/D;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,MAAM,eAAe,CACzB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAChE,CACF,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,aAAa,GAAG,eAAe,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C;;;;;OAKG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjD;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACzC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ModestBench Plugin Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for third-party reporter plugins. These types are exported
|
|
5
|
+
* from the main package for use by plugin authors.
|
|
6
|
+
*/
|
|
7
|
+
import type { Reporter } from "./interfaces.js";
|
|
8
|
+
import type { Logger } from "./utility.js";
|
|
9
|
+
/**
|
|
10
|
+
* Class constructor for reporter plugins
|
|
11
|
+
*
|
|
12
|
+
* Plugin authors can export a default class matching this signature. The class
|
|
13
|
+
* constructor receives options from the config file and a context object with
|
|
14
|
+
* utilities.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type { Reporter, ReporterContext } from 'modestbench';
|
|
20
|
+
*
|
|
21
|
+
* interface MyReporterOptions {
|
|
22
|
+
* verbose?: boolean;
|
|
23
|
+
* outputFormat?: 'text' | 'markdown';
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* class MyReporter implements Reporter {
|
|
27
|
+
* constructor(
|
|
28
|
+
* private options: MyReporterOptions,
|
|
29
|
+
* private context: ReporterContext,
|
|
30
|
+
* ) {}
|
|
31
|
+
*
|
|
32
|
+
* onStart(run) {
|
|
33
|
+
* if (this.options.verbose) console.log('Starting');
|
|
34
|
+
* }
|
|
35
|
+
* onEnd(run) {
|
|
36
|
+
* console.log('Done');
|
|
37
|
+
* }
|
|
38
|
+
* onError(error) {
|
|
39
|
+
* console.error(error);
|
|
40
|
+
* }
|
|
41
|
+
* onTaskResult(result) {
|
|
42
|
+
* console.log(
|
|
43
|
+
* `${result.name}: ${this.context.utils.formatDuration(result.mean)}`,
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* export default MyReporter;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @typeParam TOptions - The shape of the options object (defaults to
|
|
52
|
+
* Record<string, unknown>)
|
|
53
|
+
*/
|
|
54
|
+
export interface ReporterClass<TOptions extends Record<string, unknown> = Record<string, unknown>> {
|
|
55
|
+
new (options?: TOptions, context?: ReporterContext): Reporter;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Context provided to reporter plugins
|
|
59
|
+
*
|
|
60
|
+
* Contains version information and utility functions that plugins can use.
|
|
61
|
+
*/
|
|
62
|
+
export interface ReporterContext {
|
|
63
|
+
/**
|
|
64
|
+
* Logger for reporter output
|
|
65
|
+
*
|
|
66
|
+
* Use this instead of console.log/console.error to ensure output respects the
|
|
67
|
+
* user's verbosity settings and uses the correct output streams.
|
|
68
|
+
*/
|
|
69
|
+
readonly logger: Logger;
|
|
70
|
+
/**
|
|
71
|
+
* Plugin API version
|
|
72
|
+
*
|
|
73
|
+
* Incremented when breaking changes are made to the plugin API. Currently
|
|
74
|
+
* version 1.
|
|
75
|
+
*/
|
|
76
|
+
readonly pluginApiVersion: number;
|
|
77
|
+
/**
|
|
78
|
+
* Utility functions for formatting benchmark data
|
|
79
|
+
*/
|
|
80
|
+
readonly utils: ReporterUtils;
|
|
81
|
+
/**
|
|
82
|
+
* ModestBench version
|
|
83
|
+
*
|
|
84
|
+
* Plugins can use this to check compatibility.
|
|
85
|
+
*/
|
|
86
|
+
readonly version: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Factory function for creating reporter instances
|
|
90
|
+
*
|
|
91
|
+
* Plugin authors can export a default function matching this signature. The
|
|
92
|
+
* function receives options from the config file and a context object with
|
|
93
|
+
* utilities. Use the generic parameter to define the shape of your options.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
*
|
|
97
|
+
* ```typescript
|
|
98
|
+
* import type { ReporterFactory } from 'modestbench';
|
|
99
|
+
*
|
|
100
|
+
* interface MyReporterOptions {
|
|
101
|
+
* verbose?: boolean;
|
|
102
|
+
* outputFormat?: 'text' | 'markdown';
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* const createReporter: ReporterFactory<MyReporterOptions> = (
|
|
106
|
+
* options,
|
|
107
|
+
* context,
|
|
108
|
+
* ) => {
|
|
109
|
+
* return {
|
|
110
|
+
* onStart(run) {
|
|
111
|
+
* if (options.verbose) console.log('Starting');
|
|
112
|
+
* },
|
|
113
|
+
* onEnd(run) {
|
|
114
|
+
* console.log('Done');
|
|
115
|
+
* },
|
|
116
|
+
* onError(error) {
|
|
117
|
+
* console.error(error);
|
|
118
|
+
* },
|
|
119
|
+
* onTaskResult(result) {
|
|
120
|
+
* console.log(
|
|
121
|
+
* `${result.name}: ${context.utils.formatDuration(result.mean)}`,
|
|
122
|
+
* );
|
|
123
|
+
* },
|
|
124
|
+
* };
|
|
125
|
+
* };
|
|
126
|
+
*
|
|
127
|
+
* export default createReporter;
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @typeParam TOptions - The shape of the options object (defaults to
|
|
131
|
+
* Record<string, unknown>)
|
|
132
|
+
*/
|
|
133
|
+
export type ReporterFactory<TOptions extends Record<string, unknown> = Record<string, unknown>> = (options: TOptions, context: ReporterContext) => Promise<Reporter> | Reporter;
|
|
134
|
+
/**
|
|
135
|
+
* Union type representing all valid reporter plugin exports
|
|
136
|
+
*
|
|
137
|
+
* A reporter plugin module can export:
|
|
138
|
+
*
|
|
139
|
+
* - A plain Reporter object (simplest form, no options)
|
|
140
|
+
* - A ReporterClass constructor (instantiated with options)
|
|
141
|
+
* - A ReporterFactory function (most flexible, supports async)
|
|
142
|
+
*/
|
|
143
|
+
export type ReporterPlugin = Reporter | ReporterClass | ReporterFactory;
|
|
144
|
+
/**
|
|
145
|
+
* Utility functions available to reporter plugins
|
|
146
|
+
*
|
|
147
|
+
* These functions help format benchmark data consistently.
|
|
148
|
+
*/
|
|
149
|
+
export interface ReporterUtils {
|
|
150
|
+
/**
|
|
151
|
+
* Format bytes in human-readable format
|
|
152
|
+
*
|
|
153
|
+
* @param bytes - Number of bytes
|
|
154
|
+
* @returns Formatted string (e.g., "1.5 GB", "256 MB")
|
|
155
|
+
*/
|
|
156
|
+
formatBytes(bytes: number): string;
|
|
157
|
+
/**
|
|
158
|
+
* Format duration in human-readable format
|
|
159
|
+
*
|
|
160
|
+
* @param nanoseconds - Duration in nanoseconds
|
|
161
|
+
* @returns Formatted string (e.g., "1.23ms", "456.78μs")
|
|
162
|
+
*/
|
|
163
|
+
formatDuration(nanoseconds: number): string;
|
|
164
|
+
/**
|
|
165
|
+
* Format operations per second
|
|
166
|
+
*
|
|
167
|
+
* @param opsPerSecond - Operations per second
|
|
168
|
+
* @returns Formatted string (e.g., "1.2M ops/sec", "456K ops/sec")
|
|
169
|
+
*/
|
|
170
|
+
formatOpsPerSecond(opsPerSecond: number): string;
|
|
171
|
+
/**
|
|
172
|
+
* Format percentage value
|
|
173
|
+
*
|
|
174
|
+
* @param value - Percentage value
|
|
175
|
+
* @returns Formatted string (e.g., "12.34%")
|
|
176
|
+
*/
|
|
177
|
+
formatPercentage(value: number): string;
|
|
178
|
+
}
|
|
179
|
+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