@kubb/core 5.0.0-beta.85 → 5.0.0-beta.87
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/dist/{Diagnostics-PnPLU3kj.d.ts → Diagnostics-aWJg-H2d.d.ts} +90 -98
- package/dist/index.cjs +170 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +36 -3
- package/dist/index.js +170 -198
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/dist/{usingCtx-fxRpJw0P.cjs → usingCtx-BN2OKJRx.cjs} +72 -48
- package/dist/usingCtx-BN2OKJRx.cjs.map +1 -0
- package/dist/{usingCtx-BABTfo1g.js → usingCtx-Cnrm3TcM.js} +61 -43
- package/dist/usingCtx-Cnrm3TcM.js.map +1 -0
- package/package.json +2 -2
- package/dist/usingCtx-BABTfo1g.js.map +0 -1
- package/dist/usingCtx-fxRpJw0P.cjs.map +0 -1
|
@@ -277,7 +277,7 @@ type ReporterContext = {
|
|
|
277
277
|
};
|
|
278
278
|
/**
|
|
279
279
|
* Host-facing reporter, as installed onto a run. Unlike a Logger (the live TUI view), a reporter
|
|
280
|
-
* never sees the
|
|
280
|
+
* never sees the hook emitter. `report` runs once per config. `drain`, when present, runs once
|
|
281
281
|
* after the last config.
|
|
282
282
|
*/
|
|
283
283
|
type Reporter = {
|
|
@@ -309,7 +309,7 @@ type UserReporter<T = void> = {
|
|
|
309
309
|
/**
|
|
310
310
|
* Defines a reporter. When the definition has a `drain`, the returned reporter buffers each value
|
|
311
311
|
* `report` returns and hands the array to `drain` once, then clears it. Without a `drain`, nothing
|
|
312
|
-
* is buffered. Wiring the reporter onto the run's
|
|
312
|
+
* is buffered. Wiring the reporter onto the run's hooks is the host's job, so the reporter only
|
|
313
313
|
* ever deals with a {@link GenerationResult}.
|
|
314
314
|
*
|
|
315
315
|
* @example
|
|
@@ -473,7 +473,7 @@ type RendererFactory<TElement = unknown> = () => Renderer<TElement>;
|
|
|
473
473
|
*/
|
|
474
474
|
declare function createRenderer<TElement = unknown>(factory: RendererFactory<TElement>): RendererFactory<TElement>;
|
|
475
475
|
//#endregion
|
|
476
|
-
//#region src/
|
|
476
|
+
//#region src/Resolver.d.ts
|
|
477
477
|
/**
|
|
478
478
|
* Context for resolving filtered options for a given operation or schema node.
|
|
479
479
|
*
|
|
@@ -635,19 +635,14 @@ type ResolverBuildOptions = {
|
|
|
635
635
|
[key: string]: unknown;
|
|
636
636
|
};
|
|
637
637
|
/**
|
|
638
|
-
* Partial resolver fields accepted by `Resolver.merge` and `setResolver`.
|
|
638
|
+
* Partial resolver fields accepted by `Resolver.merge` and `setResolver`. Parameterize with a
|
|
639
|
+
* concrete resolver type (e.g. `ResolverPatch<ResolverTs>`) to type-check namespace overrides
|
|
640
|
+
* and bind `this` to the full resolver. The bare form accepts any resolver's fields.
|
|
639
641
|
*/
|
|
640
|
-
type
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
* which `ThisType` types as the full resolver.
|
|
645
|
-
*/
|
|
646
|
-
type ResolverOptions<T extends PluginFactoryOptions> = Omit<T['resolver'], keyof Resolver> & {
|
|
647
|
-
pluginName: T['name'];
|
|
648
|
-
name?: T['resolver']['name'];
|
|
649
|
-
file?: T['resolver']['file'];
|
|
650
|
-
} & ThisType<T['resolver']>;
|
|
642
|
+
type ResolverPatch<T extends Resolver = Resolver> = Partial<Omit<T, keyof Resolver>> & {
|
|
643
|
+
name?: T['name'];
|
|
644
|
+
file?: T['file'];
|
|
645
|
+
} & ThisType<T>;
|
|
651
646
|
/**
|
|
652
647
|
* Base constraint for all plugin resolver objects.
|
|
653
648
|
*
|
|
@@ -687,29 +682,8 @@ declare class Resolver {
|
|
|
687
682
|
* Merges `override` over `base` and returns a new resolver with helpers re-bound.
|
|
688
683
|
* Each key is replaced wholesale. Used when applying `setResolver` partial overrides.
|
|
689
684
|
*/
|
|
690
|
-
static merge<T extends Resolver>(base: T, override:
|
|
685
|
+
static merge<T extends Resolver>(base: T, override: ResolverPatch<T> | Resolver): T;
|
|
691
686
|
}
|
|
692
|
-
/**
|
|
693
|
-
* Defines a plugin resolver, the object that decides what every generated symbol and file
|
|
694
|
-
* path is called. Override the top-level `name` and `file` to set the plugin's conventions,
|
|
695
|
-
* and add your own naming helpers, top-level (`typeName`, …) or grouped in namespaces
|
|
696
|
-
* (`query`, `schema`, …). Every method reaches sibling helpers and the built-in machinery
|
|
697
|
-
* through `this.name`, `this.file`, and `this.default`.
|
|
698
|
-
*
|
|
699
|
-
* @example Custom identifier and file casing
|
|
700
|
-
* ```ts
|
|
701
|
-
* export const resolverTs = createResolver<PluginTs>({
|
|
702
|
-
* pluginName: 'plugin-ts',
|
|
703
|
-
* name(name) {
|
|
704
|
-
* return ensureValidVarName(pascalCase(name))
|
|
705
|
-
* },
|
|
706
|
-
* file(params, context) {
|
|
707
|
-
* return this.default.file({ ...params, resolveName: (name) => toFilePath(name, pascalCase) }, context)
|
|
708
|
-
* },
|
|
709
|
-
* })
|
|
710
|
-
* ```
|
|
711
|
-
*/
|
|
712
|
-
declare function createResolver<T extends PluginFactoryOptions>(options: ResolverOptions<T>): T['resolver'];
|
|
713
687
|
//#endregion
|
|
714
688
|
//#region src/definePlugin.d.ts
|
|
715
689
|
type ExtractRegistryKey$1<T, K extends PropertyKey> = K extends keyof T ? T[K] : {};
|
|
@@ -970,7 +944,7 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
970
944
|
* The resolver controls file naming and path resolution. Overrides merge over the built-in
|
|
971
945
|
* defaults, so a partial `core` or a single namespace method replaces only what it names.
|
|
972
946
|
*/
|
|
973
|
-
setResolver(resolver:
|
|
947
|
+
setResolver(resolver: ResolverPatch<TFactory['resolver']> | TFactory['resolver']): void;
|
|
974
948
|
/**
|
|
975
949
|
* Add a macro that rewrites AST nodes before they reach generators. Macros run in the order they
|
|
976
950
|
* are added, after any macros from earlier `addMacro` calls.
|
|
@@ -1034,8 +1008,8 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
1034
1008
|
*/
|
|
1035
1009
|
options?: TFactory['options'];
|
|
1036
1010
|
/**
|
|
1037
|
-
* Lifecycle
|
|
1038
|
-
* Any
|
|
1011
|
+
* Lifecycle hook handlers for this plugin.
|
|
1012
|
+
* Any hook from the global `KubbHooks` map can be subscribed to here.
|
|
1039
1013
|
*/
|
|
1040
1014
|
hooks: { [K in keyof KubbHooks as K extends 'kubb:plugin:setup' ? never : K]?: (...args: KubbHooks[K]) => void | Promise<void> } & {
|
|
1041
1015
|
'kubb:plugin:setup'?(ctx: KubbPluginSetupContext<TFactory>): void | Promise<void>;
|
|
@@ -1057,6 +1031,11 @@ type NormalizedPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1057
1031
|
resolver: TOptions['resolver'];
|
|
1058
1032
|
macros?: Array<Macro>;
|
|
1059
1033
|
generators?: Array<Generator>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Set by the driver when the plugin registers a generator via `addGenerator()` in
|
|
1036
|
+
* `kubb:plugin:setup`. Drives whether the build walks the AST for this plugin.
|
|
1037
|
+
*/
|
|
1038
|
+
hasHookGenerators?: boolean;
|
|
1060
1039
|
apply?: (config: Config) => boolean;
|
|
1061
1040
|
version?: string;
|
|
1062
1041
|
};
|
|
@@ -1162,86 +1141,99 @@ type Parser<TMeta extends object = object, TNode = unknown> = {
|
|
|
1162
1141
|
*/
|
|
1163
1142
|
declare function defineParser<T extends Parser>(parser: T): T;
|
|
1164
1143
|
//#endregion
|
|
1165
|
-
//#region src/
|
|
1144
|
+
//#region src/Hookable.d.ts
|
|
1166
1145
|
/**
|
|
1167
|
-
* A function that can be registered as
|
|
1146
|
+
* A function that can be registered as a hook listener, synchronous or async. Any return value is
|
|
1147
|
+
* allowed and ignored, so handlers that return a result for their own callers still register.
|
|
1168
1148
|
*/
|
|
1169
|
-
type AsyncListener<TArgs extends Array<unknown>> = (...args: TArgs) =>
|
|
1149
|
+
type AsyncListener<TArgs extends Array<unknown>> = (...args: TArgs) => unknown;
|
|
1170
1150
|
/**
|
|
1171
|
-
* Typed
|
|
1172
|
-
* Wraps Node's `EventEmitter` with full TypeScript
|
|
1151
|
+
* Typed hook emitter that awaits all async listeners before resolving.
|
|
1152
|
+
* Wraps Node's `EventEmitter` with full TypeScript hook-map inference.
|
|
1173
1153
|
*
|
|
1174
1154
|
* @example
|
|
1175
1155
|
* ```ts
|
|
1176
|
-
* const
|
|
1177
|
-
*
|
|
1178
|
-
* await
|
|
1156
|
+
* const hooks = new Hookable<{ build: [name: string] }>()
|
|
1157
|
+
* hooks.hook('build', async (name) => { console.log(name) })
|
|
1158
|
+
* await hooks.callHook('build', 'petstore') // all listeners awaited
|
|
1179
1159
|
* ```
|
|
1180
1160
|
*/
|
|
1181
|
-
declare class
|
|
1161
|
+
declare class Hookable<THooks extends { [K in keyof THooks]: Array<unknown> }> {
|
|
1182
1162
|
#private;
|
|
1183
1163
|
/**
|
|
1184
|
-
* Maximum number of listeners per
|
|
1164
|
+
* Maximum number of listeners per hook before Node emits a memory-leak warning.
|
|
1185
1165
|
* @default 10
|
|
1186
1166
|
*/
|
|
1187
1167
|
constructor(maxListener?: number);
|
|
1188
1168
|
/**
|
|
1189
|
-
*
|
|
1190
|
-
* Throws if any listener rejects, wrapping the cause with the
|
|
1169
|
+
* Calls `hookName` and awaits all registered listeners sequentially.
|
|
1170
|
+
* Throws if any listener rejects, wrapping the cause with the hook name and serialized arguments.
|
|
1191
1171
|
*
|
|
1192
1172
|
* @example
|
|
1193
1173
|
* ```ts
|
|
1194
|
-
* await
|
|
1174
|
+
* await hooks.callHook('build', 'petstore')
|
|
1195
1175
|
* ```
|
|
1196
1176
|
*/
|
|
1197
|
-
|
|
1177
|
+
callHook<THookName extends keyof THooks & string>(hookName: THookName, ...hookArgs: THooks[THookName]): Promise<void> | void;
|
|
1198
1178
|
/**
|
|
1199
|
-
* Registers a persistent listener for `
|
|
1179
|
+
* Registers a persistent listener for `hookName` and returns a function that removes it.
|
|
1200
1180
|
*
|
|
1201
1181
|
* @example
|
|
1202
1182
|
* ```ts
|
|
1203
|
-
*
|
|
1183
|
+
* const unhook = hooks.hook('build', async (name) => { console.log(name) })
|
|
1184
|
+
* unhook() // removes it
|
|
1204
1185
|
* ```
|
|
1205
1186
|
*/
|
|
1206
|
-
|
|
1187
|
+
hook<THookName extends keyof THooks & string>(hookName: THookName, handler: AsyncListener<THooks[THookName]>): () => void;
|
|
1188
|
+
/**
|
|
1189
|
+
* Registers every handler in `configHooks` at once and returns a function that removes them
|
|
1190
|
+
* all. Undefined entries are skipped, so a partial hook object registers only its present keys.
|
|
1191
|
+
*
|
|
1192
|
+
* @example
|
|
1193
|
+
* ```ts
|
|
1194
|
+
* const unhook = hooks.addHooks({ build: onBuild, done: onDone })
|
|
1195
|
+
* unhook() // removes both
|
|
1196
|
+
* ```
|
|
1197
|
+
*/
|
|
1198
|
+
addHooks(configHooks: Partial<{ [K in keyof THooks & string]: AsyncListener<THooks[K]> }>): () => void;
|
|
1207
1199
|
/**
|
|
1208
1200
|
* Removes a previously registered listener.
|
|
1209
1201
|
*
|
|
1210
1202
|
* @example
|
|
1211
1203
|
* ```ts
|
|
1212
|
-
*
|
|
1204
|
+
* hooks.removeHook('build', handler)
|
|
1213
1205
|
* ```
|
|
1214
1206
|
*/
|
|
1215
|
-
|
|
1207
|
+
removeHook<THookName extends keyof THooks & string>(hookName: THookName, handler: AsyncListener<THooks[THookName]>): void;
|
|
1216
1208
|
/**
|
|
1217
|
-
* Returns the number of listeners registered for `
|
|
1209
|
+
* Returns the number of listeners registered for `hookName`.
|
|
1218
1210
|
*
|
|
1219
1211
|
* @example
|
|
1220
1212
|
* ```ts
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1213
|
+
* hooks.hook('build', handler)
|
|
1214
|
+
* hooks.listenerCount('build') // 1
|
|
1223
1215
|
* ```
|
|
1224
1216
|
*/
|
|
1225
|
-
listenerCount<
|
|
1217
|
+
listenerCount<THookName extends keyof THooks & string>(hookName: THookName): number;
|
|
1226
1218
|
/**
|
|
1227
|
-
* Raises or lowers the per-
|
|
1219
|
+
* Raises or lowers the per-hook listener ceiling before Node warns about a memory leak.
|
|
1228
1220
|
* Set this above the expected listener count when many listeners attach by design.
|
|
1229
1221
|
*
|
|
1230
1222
|
* @example
|
|
1231
1223
|
* ```ts
|
|
1232
|
-
*
|
|
1224
|
+
* hooks.setMaxListeners(40)
|
|
1233
1225
|
* ```
|
|
1234
1226
|
*/
|
|
1235
1227
|
setMaxListeners(max: number): void;
|
|
1236
1228
|
/**
|
|
1237
|
-
* Removes all listeners from every
|
|
1229
|
+
* Removes all listeners from every hook channel.
|
|
1238
1230
|
*
|
|
1239
1231
|
* @example
|
|
1240
1232
|
* ```ts
|
|
1241
|
-
*
|
|
1233
|
+
* hooks.removeAllHooks()
|
|
1242
1234
|
* ```
|
|
1243
1235
|
*/
|
|
1244
|
-
|
|
1236
|
+
removeAllHooks(): void;
|
|
1245
1237
|
}
|
|
1246
1238
|
//#endregion
|
|
1247
1239
|
//#region src/FileManager.d.ts
|
|
@@ -1282,7 +1274,7 @@ type WriteOptions = ParseOptions & {
|
|
|
1282
1274
|
*/
|
|
1283
1275
|
declare class FileManager {
|
|
1284
1276
|
#private;
|
|
1285
|
-
readonly hooks:
|
|
1277
|
+
readonly hooks: Hookable<FileManagerHooks>;
|
|
1286
1278
|
add(...files: Array<FileNode>): Array<FileNode>;
|
|
1287
1279
|
upsert(...files: Array<FileNode>): Array<FileNode>;
|
|
1288
1280
|
clear(): void;
|
|
@@ -1316,7 +1308,7 @@ declare class FileManager {
|
|
|
1316
1308
|
//#endregion
|
|
1317
1309
|
//#region src/KubbDriver.d.ts
|
|
1318
1310
|
type Options = {
|
|
1319
|
-
hooks:
|
|
1311
|
+
hooks: Hookable<KubbHooks>;
|
|
1320
1312
|
};
|
|
1321
1313
|
type RequirePluginContext = {
|
|
1322
1314
|
/**
|
|
@@ -1349,16 +1341,16 @@ declare class KubbDriver {
|
|
|
1349
1341
|
* so `run` can parse it later.
|
|
1350
1342
|
*/
|
|
1351
1343
|
setup(): Promise<void>;
|
|
1352
|
-
get hooks():
|
|
1344
|
+
get hooks(): Hookable<KubbHooks>;
|
|
1353
1345
|
/**
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1346
|
+
* Runs each plugin's `kubb:plugin:setup` handler, in plugin order, with a context scoped to that
|
|
1347
|
+
* plugin so `addGenerator`, `setResolver`, `addMacro`, `setMacros`, and `setOptions` target its
|
|
1348
|
+
* `NormalizedPlugin` entry. Called once from `run` before the plugin execution loop begins, so
|
|
1349
|
+
* plugins can configure generators, resolvers, macros, and options before `buildStart`.
|
|
1358
1350
|
*/
|
|
1359
|
-
|
|
1351
|
+
setupHooks(): Promise<void>;
|
|
1360
1352
|
/**
|
|
1361
|
-
* Registers a generator for the given plugin on the shared
|
|
1353
|
+
* Registers a generator for the given plugin on the shared hook emitter.
|
|
1362
1354
|
*
|
|
1363
1355
|
* The generator's `schema`, `operation`, and `operations` methods are registered as
|
|
1364
1356
|
* listeners on `kubb:generate:schema`, `kubb:generate:operation`, and `kubb:generate:operations`
|
|
@@ -1375,10 +1367,10 @@ declare class KubbDriver {
|
|
|
1375
1367
|
* Returns `true` when at least one generator was registered for the given plugin
|
|
1376
1368
|
* via `addGenerator()` in `kubb:plugin:setup`.
|
|
1377
1369
|
*
|
|
1378
|
-
* Used by the build loop to decide whether to walk the AST and emit generator
|
|
1370
|
+
* Used by the build loop to decide whether to walk the AST and emit generator hooks
|
|
1379
1371
|
* for a plugin.
|
|
1380
1372
|
*/
|
|
1381
|
-
|
|
1373
|
+
hasHookGenerators(pluginName: string): boolean;
|
|
1382
1374
|
/**
|
|
1383
1375
|
* Runs the full plugin pipeline. Returns the diagnostics collected so far even
|
|
1384
1376
|
* when an outer hook throws, since the orchestrator preserves partial state by capturing
|
|
@@ -1424,7 +1416,7 @@ declare class KubbDriver {
|
|
|
1424
1416
|
* Also mirrors it onto `plugin.resolver` so callers using `getPlugin(name).resolver`
|
|
1425
1417
|
* get the up-to-date resolver without going through `getResolver()`.
|
|
1426
1418
|
*/
|
|
1427
|
-
setPluginResolver(pluginName: string, partial:
|
|
1419
|
+
setPluginResolver(pluginName: string, partial: ResolverPatch | Resolver): void;
|
|
1428
1420
|
/**
|
|
1429
1421
|
* Returns the resolver for the given plugin.
|
|
1430
1422
|
*
|
|
@@ -1490,10 +1482,10 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1490
1482
|
*/
|
|
1491
1483
|
upsertFile: (...file: Array<FileNode>) => Promise<void>;
|
|
1492
1484
|
/**
|
|
1493
|
-
* The build's
|
|
1485
|
+
* The build's hook bus. Emit or listen to any `KubbHooks` hook, for example to react to
|
|
1494
1486
|
* `kubb:build:end` from inside a generator.
|
|
1495
1487
|
*/
|
|
1496
|
-
hooks:
|
|
1488
|
+
hooks: Hookable<KubbHooks>;
|
|
1497
1489
|
/**
|
|
1498
1490
|
* The current plugin instance.
|
|
1499
1491
|
*/
|
|
@@ -1642,7 +1634,7 @@ declare function defineGenerator<TOptions extends PluginFactoryOptions = PluginF
|
|
|
1642
1634
|
//#endregion
|
|
1643
1635
|
//#region src/createKubb.d.ts
|
|
1644
1636
|
type CreateKubbOptions = {
|
|
1645
|
-
hooks?:
|
|
1637
|
+
hooks?: Hookable<KubbHooks>;
|
|
1646
1638
|
};
|
|
1647
1639
|
/**
|
|
1648
1640
|
* Kubb code-generation instance bound to a single config entry. Resolves the user
|
|
@@ -1652,18 +1644,18 @@ type CreateKubbOptions = {
|
|
|
1652
1644
|
* `createKubb` takes a plain config object (the shape `defineConfig` produces),
|
|
1653
1645
|
* not a fluent builder.
|
|
1654
1646
|
*
|
|
1655
|
-
* Attach
|
|
1647
|
+
* Attach hook listeners to `.hooks` before calling `setup()` or `build()`.
|
|
1656
1648
|
*
|
|
1657
1649
|
* @example
|
|
1658
1650
|
* ```ts
|
|
1659
1651
|
* const kubb = createKubb(userConfig)
|
|
1660
|
-
* kubb.hooks.
|
|
1652
|
+
* kubb.hooks.hook('kubb:plugin:end', ({ plugin, duration }) => console.log(plugin.name, duration))
|
|
1661
1653
|
* const { files, diagnostics } = await kubb.safeBuild()
|
|
1662
1654
|
* ```
|
|
1663
1655
|
*/
|
|
1664
1656
|
declare class Kubb$1 {
|
|
1665
1657
|
#private;
|
|
1666
|
-
readonly hooks:
|
|
1658
|
+
readonly hooks: Hookable<KubbHooks>;
|
|
1667
1659
|
readonly config: Config;
|
|
1668
1660
|
constructor(userConfig: UserConfig, options?: CreateKubbOptions);
|
|
1669
1661
|
get storage(): Storage;
|
|
@@ -1922,7 +1914,7 @@ type Config<TInput = Input> = {
|
|
|
1922
1914
|
*/
|
|
1923
1915
|
plugins: Array<Plugin>;
|
|
1924
1916
|
/**
|
|
1925
|
-
* Lifecycle hooks that run external tools (prettier, eslint, a custom script)
|
|
1917
|
+
* Lifecycle hooks that run external tools (prettier, eslint, a custom script) at points in the build.
|
|
1926
1918
|
*
|
|
1927
1919
|
* Currently supports the `done` hook, which fires after all plugins complete.
|
|
1928
1920
|
*
|
|
@@ -2081,16 +2073,16 @@ declare global {
|
|
|
2081
2073
|
}
|
|
2082
2074
|
}
|
|
2083
2075
|
/**
|
|
2084
|
-
* Lifecycle
|
|
2076
|
+
* Lifecycle hooks emitted during Kubb code generation.
|
|
2085
2077
|
* Attach listeners before calling `setup()` or `build()` to observe and react to build progress.
|
|
2086
2078
|
*
|
|
2087
2079
|
* @example
|
|
2088
2080
|
* ```ts
|
|
2089
|
-
* kubb.hooks.
|
|
2081
|
+
* kubb.hooks.hook('kubb:lifecycle:start', () => {
|
|
2090
2082
|
* console.log('Starting Kubb generation')
|
|
2091
2083
|
* })
|
|
2092
2084
|
*
|
|
2093
|
-
* kubb.hooks.
|
|
2085
|
+
* kubb.hooks.hook('kubb:plugin:end', ({ plugin, duration }) => {
|
|
2094
2086
|
* console.log(`${plugin.name} completed in ${duration}ms`)
|
|
2095
2087
|
* })
|
|
2096
2088
|
* ```
|
|
@@ -2326,7 +2318,7 @@ type KubbFilesProcessingEndContext = {
|
|
|
2326
2318
|
};
|
|
2327
2319
|
type KubbHookStartContext = {
|
|
2328
2320
|
/**
|
|
2329
|
-
* Optional identifier for correlating start/end
|
|
2321
|
+
* Optional identifier for correlating start/end hooks.
|
|
2330
2322
|
*/
|
|
2331
2323
|
id?: string;
|
|
2332
2324
|
/**
|
|
@@ -2344,7 +2336,7 @@ type KubbHookStartContext = {
|
|
|
2344
2336
|
*/
|
|
2345
2337
|
type KubbHookLineContext = {
|
|
2346
2338
|
/**
|
|
2347
|
-
* Identifier matching the corresponding `kubb:hook:start`
|
|
2339
|
+
* Identifier matching the corresponding `kubb:hook:start` hook.
|
|
2348
2340
|
*/
|
|
2349
2341
|
id: string;
|
|
2350
2342
|
/**
|
|
@@ -2354,7 +2346,7 @@ type KubbHookLineContext = {
|
|
|
2354
2346
|
};
|
|
2355
2347
|
type KubbHookEndContext = {
|
|
2356
2348
|
/**
|
|
2357
|
-
* Optional identifier matching the corresponding `kubb:hook:start`
|
|
2349
|
+
* Optional identifier matching the corresponding `kubb:hook:start` hook.
|
|
2358
2350
|
*/
|
|
2359
2351
|
id?: string;
|
|
2360
2352
|
/**
|
|
@@ -2707,11 +2699,11 @@ declare class Diagnostics {
|
|
|
2707
2699
|
*/
|
|
2708
2700
|
static report(diagnostic: Diagnostic): boolean;
|
|
2709
2701
|
/**
|
|
2710
|
-
* Emits a diagnostic on the run's `kubb:diagnostic`
|
|
2711
|
-
* Use it instead of calling `hooks.
|
|
2702
|
+
* Emits a diagnostic on the run's `kubb:diagnostic` hook so the loggers render it live.
|
|
2703
|
+
* Use it instead of calling `hooks.callHook('kubb:diagnostic', ...)` directly. To collect a
|
|
2712
2704
|
* diagnostic into the build result from deep in a run, use {@link Diagnostics.report} instead.
|
|
2713
2705
|
*/
|
|
2714
|
-
static emit(hooks:
|
|
2706
|
+
static emit(hooks: Hookable<KubbHooks>, diagnostic: ProblemDiagnostic | UpdateDiagnostic): Promise<void>;
|
|
2715
2707
|
/**
|
|
2716
2708
|
* Coerces any thrown value into a {@link ProblemDiagnostic}. A {@link Diagnostics.Error}
|
|
2717
2709
|
* keeps its structured data, and anything else becomes a `KUBB_UNKNOWN` error.
|
|
@@ -2797,5 +2789,5 @@ declare class Diagnostics {
|
|
|
2797
2789
|
static formatLines(diagnostic: Diagnostic): Array<string>;
|
|
2798
2790
|
}
|
|
2799
2791
|
//#endregion
|
|
2800
|
-
export { Include as $, KubbHookStartContext as A,
|
|
2801
|
-
//# sourceMappingURL=Diagnostics-
|
|
2792
|
+
export { Include as $, KubbHookStartContext as A, UserReporter as At, Kubb$1 as B, KubbFilesProcessingEndContext as C, createRenderer as Ct, KubbGenerationStartContext as D, Reporter as Dt, KubbGenerationEndContext as E, GenerationResult as Et, KubbSuccessContext as F, AdapterSource as Ft, KubbDriver as G, Generator as H, KubbWarnContext as I, createAdapter as It, Parser as J, FileManagerHooks as K, PossibleConfig as L, KubbInfoContext as M, logLevel as Mt, KubbLifecycleStartContext as N, Adapter as Nt, KubbHookEndContext as O, ReporterContext as Ot, KubbPluginsEndContext as P, AdapterFactoryOptions as Pt, Group as Q, UserConfig as R, KubbFileProcessingUpdate as S, RendererFactory as St, KubbFilesProcessingUpdateContext as T, createStorage as Tt, GeneratorContext as U, createKubb as V, defineGenerator as W, Exclude$1 as X, defineParser as Y, Filter as Z, InputPath as _, ResolverDefault as _t, DiagnosticLocation as a, OutputMode as at, KubbDiagnosticContext as b, ResolverPathParams as bt, PerformanceDiagnostic as c, Plugin as ct, SerializedDiagnostic as d, BannerMeta as dt, KubbPluginEndContext as et, UpdateDiagnostic as f, ResolveBannerContext as ft, InputData as g, ResolverContext as gt, Config as h, Resolver as ht, DiagnosticKind as i, Output as it, KubbHooks as j, createReporter as jt, KubbHookLineContext as k, ReporterName as kt, ProblemCode as l, PluginFactoryOptions as lt, CLIOptions as m, ResolveOptionsContext as mt, DiagnosticByCode as n, KubbPluginStartContext as nt, DiagnosticSeverity as o, OutputOptions as ot, BuildOutput as p, ResolveBannerFile as pt, Hookable as q, DiagnosticDoc as r, NormalizedPlugin as rt, Diagnostics as s, Override as st, Diagnostic as t, KubbPluginSetupContext as tt, ProblemDiagnostic as u, definePlugin as ut, KubbBuildEndContext as v, ResolverFileParams as vt, KubbFilesProcessingStartContext as w, Storage as wt, KubbErrorContext as x, Renderer as xt, KubbBuildStartContext as y, ResolverPatch as yt, CreateKubbOptions as z };
|
|
2793
|
+
//# sourceMappingURL=Diagnostics-aWJg-H2d.d.ts.map
|