@kubb/core 5.0.0-beta.91 → 5.0.0-beta.94

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/index.cjs CHANGED
@@ -192,7 +192,7 @@ function memoize(store, factory) {
192
192
  }
193
193
  //#endregion
194
194
  //#region package.json
195
- var version = "5.0.0-beta.91";
195
+ var version = "5.0.0-beta.94";
196
196
  //#endregion
197
197
  //#region src/constants.ts
198
198
  /**
@@ -274,9 +274,9 @@ const diagnosticCode = {
274
274
  */
275
275
  invalidPluginOptions: "KUBB_INVALID_PLUGIN_OPTIONS",
276
276
  /**
277
- * A post-generate shell hook (`hooks.done`) exited with a failure.
277
+ * A post-generate command (`output.postGenerate`) exited with a failure.
278
278
  */
279
- hookFailed: "KUBB_HOOK_FAILED",
279
+ postGenerateFailed: "KUBB_POST_GENERATE_FAILED",
280
280
  /**
281
281
  * The formatter pass over the generated files failed.
282
282
  */
@@ -301,20 +301,6 @@ const diagnosticCode = {
301
301
  */
302
302
  const docsMajor = version.split(".")[0] ?? "5";
303
303
  /**
304
- * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
305
- *
306
- * @example
307
- * ```ts
308
- * const update = narrow(diagnostic, diagnosticCode.updateAvailable)
309
- * if (update) {
310
- * console.log(update.latestVersion)
311
- * }
312
- * ```
313
- */
314
- function narrow(diagnostic, code) {
315
- return diagnostic.code === code ? diagnostic : null;
316
- }
317
- /**
318
304
  * Builds a type guard that narrows a {@link Diagnostic} to the variant for `kind`. A diagnostic
319
305
  * with no `kind` is treated as a `problem`.
320
306
  */
@@ -436,9 +422,9 @@ const diagnosticCatalog = {
436
422
  cause: "A plugin was configured with options that cannot be honored, for example `output.mode: 'file'` paired with a `group` option.",
437
423
  fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option or use `output.mode: 'directory'`."
438
424
  },
439
- [diagnosticCode.hookFailed]: {
440
- title: "Hook failed",
441
- cause: "A post-generate shell hook (`hooks.done`) exited with a non-zero status.",
425
+ [diagnosticCode.postGenerateFailed]: {
426
+ title: "Post-generate command failed",
427
+ cause: "A post-generate command (`output.postGenerate`) exited with a non-zero status.",
442
428
  fix: "Check the command is installed and correct, and run it manually to see the error."
443
429
  },
444
430
  [diagnosticCode.formatFailed]: {
@@ -490,10 +476,6 @@ var Diagnostics = class Diagnostics {
490
476
  */
491
477
  static isPerformance = isPerformance;
492
478
  /**
493
- * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
494
- */
495
- static narrow = narrow;
496
- /**
497
479
  * An `Error` that carries a {@link Diagnostic}, so structured problems can flow
498
480
  * through the existing throw/catch paths while keeping their code and location.
499
481
  *
@@ -1321,7 +1303,8 @@ var KubbDriver = class {
1321
1303
  },
1322
1304
  exclude: [],
1323
1305
  override: []
1324
- }
1306
+ },
1307
+ resolver: this.#getDefaultResolver(rawPlugin.name)
1325
1308
  };
1326
1309
  }));
1327
1310
  for (const plugin of normalized) {
@@ -2161,10 +2144,10 @@ const logLevel = {
2161
2144
  verbose: 4
2162
2145
  };
2163
2146
  /**
2164
- * Defines a reporter. When the definition has a `drain`, the returned reporter buffers each value
2165
- * `report` returns and hands the array to `drain` once, then clears it. Without a `drain`, nothing
2166
- * is buffered. Wiring the reporter onto the run's hooks is the host's job, so the reporter only
2167
- * ever deals with a {@link GenerationResult}.
2147
+ * Defines a reporter. The returned reporter buffers each value `report` returns in order and, when
2148
+ * the definition has a `drain`, hands the array to `drain` once and then clears it. Wiring the
2149
+ * reporter onto the run's hooks is the host's job, so the reporter only ever deals with a
2150
+ * {@link GenerationResult}.
2168
2151
  *
2169
2152
  * @example
2170
2153
  * ```ts
@@ -2182,19 +2165,19 @@ const logLevel = {
2182
2165
  * ```
2183
2166
  */
2184
2167
  function createReporter(reporter) {
2185
- const reports = /* @__PURE__ */ new Set();
2168
+ const reports = [];
2186
2169
  return {
2187
2170
  name: reporter.name,
2188
2171
  async report(result, context) {
2189
2172
  const report = await reporter.report(result, context);
2190
- reports.add(report);
2173
+ if (reporter.drain) reports.push(report);
2191
2174
  },
2192
2175
  async drain(context) {
2193
- await reporter.drain?.(context, Array.from(reports));
2194
- reports.clear();
2176
+ await reporter.drain?.(context, [...reports]);
2177
+ reports.length = 0;
2195
2178
  },
2196
2179
  [Symbol.dispose]() {
2197
- reports.clear();
2180
+ reports.length = 0;
2198
2181
  }
2199
2182
  };
2200
2183
  }