@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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { $ as ResolveBannerFile, A as GeneratorContext, At as ProblemCode, B as KubbPluginEndContext, C as KubbWarnContext, Ct as DiagnosticByCode, D as Kubb, Dt as DiagnosticSeverity, E as CreateKubbOptions, Et as DiagnosticLocation, F as defineParser, Ft as Adapter, G as OutputMode, H as KubbPluginStartContext, I as Exclude, It as AdapterFactoryOptions, J as Plugin, K as OutputOptions, L as Filter, Lt as AdapterSource, M as KubbDriver, Mt as SerializedDiagnostic, N as FileManagerHooks, Nt as UpdateDiagnostic, O as createKubb, Ot as Diagnostics, P as Parser, Pt as Hookable, Q as ResolveBannerContext, R as Group, Rt as createAdapter, S as KubbSuccessContext, St as Diagnostic, T as UserConfig, Tt as DiagnosticKind, U as NormalizedPlugin, V as KubbPluginSetupContext, W as Output, X as definePlugin, Y as PluginFactoryOptions, Z as BannerMeta, _ as KubbHookStartContext, _t as ReporterContext, a as KubbBuildEndContext, at as ResolverFile, b as KubbLifecycleStartContext, bt as createReporter, c as KubbErrorContext, ct as ResolverPatch, d as KubbFilesProcessingStartContext, dt as RendererFactory, et as ResolveFileOptions, f as KubbFilesProcessingUpdateContext, ft as createRenderer, g as KubbHookLineContext, gt as Reporter, h as KubbHookEndContext, ht as GenerationResult, i as Input, it as ResolverDefault, j as defineGenerator, jt as ProblemDiagnostic, k as Generator, kt as PerformanceDiagnostic, l as KubbFileProcessingUpdate, lt as ResolverPathParams, m as KubbGenerationStartContext, mt as createStorage, n as CLIOptions, nt as ResolvePathOptions, o as KubbBuildStartContext, ot as ResolverFileParams, p as KubbGenerationEndContext, pt as Storage, q as Override, r as Config, rt as Resolver, s as KubbDiagnosticContext, st as ResolverFilePathParams, t as BuildOutput, tt as ResolveOptionsContext, u as KubbFilesProcessingEndContext, ut as Renderer, v as KubbHooks, vt as ReporterName, w as PossibleConfig, wt as DiagnosticDoc, x as KubbPluginsEndContext, xt as logLevel, y as KubbInfoContext, yt as UserReporter, z as Include } from "./types-aNebW3Ui.js";
2
+ import { $ as ResolveBannerContext, A as Generator, At as ProblemCode, B as Include, C as KubbWarnContext, Ct as Diagnostic, D as CreateKubbOptions, Dt as DiagnosticSeverity, E as UserConfig, Et as DiagnosticLocation, F as Parser, Ft as Adapter, G as Output, H as KubbPluginSetupContext, I as defineParser, It as AdapterFactoryOptions, J as Override, K as OutputMode, L as Exclude, Lt as AdapterSource, M as defineGenerator, Mt as SerializedDiagnostic, N as KubbDriver, Nt as UpdateDiagnostic, O as Kubb, Ot as Diagnostics, P as FileManagerHooks, Pt as Hookable, Q as BannerMeta, R as Filter, Rt as createAdapter, S as KubbSuccessContext, St as logLevel, T as PostGenerateCommand, Tt as DiagnosticKind, U as KubbPluginStartContext, V as KubbPluginEndContext, W as NormalizedPlugin, X as PluginFactoryOptions, Y as Plugin, Z as definePlugin, _ as KubbHookStartContext, _t as Reporter, a as KubbBuildEndContext, at as ResolverDefault, b as KubbLifecycleStartContext, bt as UserReporter, c as KubbErrorContext, ct as ResolverFilePathParams, d as KubbFilesProcessingStartContext, dt as Renderer, et as ResolveBannerFile, f as KubbFilesProcessingUpdateContext, ft as RendererFactory, g as KubbHookLineContext, gt as GenerationResult, h as KubbHookEndContext, ht as createStorage, i as Input, it as Resolver, j as GeneratorContext, jt as ProblemDiagnostic, k as createKubb, kt as PerformanceDiagnostic, l as KubbFileProcessingUpdate, lt as ResolverPatch, m as KubbGenerationStartContext, mt as Storage, n as CLIOptions, nt as ResolveOptionsContext, o as KubbBuildStartContext, ot as ResolverFile, p as KubbGenerationEndContext, pt as createRenderer, q as OutputOptions, r as Config, rt as ResolvePathOptions, s as KubbDiagnosticContext, st as ResolverFileParams, t as BuildOutput, tt as ResolveFileOptions, u as KubbFilesProcessingEndContext, ut as ResolverPathParams, v as KubbHooks, vt as ReporterContext, w as PossibleConfig, wt as DiagnosticDoc, x as KubbPluginsEndContext, xt as createReporter, y as KubbInfoContext, yt as ReporterName, z as Group } from "./types-DF9c3DGO.js";
3
3
 
4
4
  //#region src/applyConfigDefaults.d.ts
5
5
  type ApplyConfigDefaultsOptions<TOutput> = {
@@ -188,5 +188,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
188
188
  */
189
189
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
190
190
  //#endregion
191
- export { type Adapter, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticByCode, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileManagerHooks, type Filter, type GenerationResult, type Generator, type GeneratorContext, type Group, Hookable, type Include, Input, type InputKind, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, PossibleConfig, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveOptionsContext, type ResolvePathOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, UserConfig, type UserReporter, applyConfigDefaults, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, jsonReporter, logLevel, memoryStorage };
191
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileManagerHooks, type Filter, type GenerationResult, type Generator, type GeneratorContext, type Group, Hookable, type Include, Input, type InputKind, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, PossibleConfig, PostGenerateCommand, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveOptionsContext, type ResolvePathOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, UserConfig, type UserReporter, applyConfigDefaults, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, jsonReporter, logLevel, memoryStorage };
192
192
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -190,7 +190,7 @@ function memoize(store, factory) {
190
190
  }
191
191
  //#endregion
192
192
  //#region package.json
193
- var version = "5.0.0-beta.91";
193
+ var version = "5.0.0-beta.94";
194
194
  //#endregion
195
195
  //#region src/constants.ts
196
196
  /**
@@ -272,9 +272,9 @@ const diagnosticCode = {
272
272
  */
273
273
  invalidPluginOptions: "KUBB_INVALID_PLUGIN_OPTIONS",
274
274
  /**
275
- * A post-generate shell hook (`hooks.done`) exited with a failure.
275
+ * A post-generate command (`output.postGenerate`) exited with a failure.
276
276
  */
277
- hookFailed: "KUBB_HOOK_FAILED",
277
+ postGenerateFailed: "KUBB_POST_GENERATE_FAILED",
278
278
  /**
279
279
  * The formatter pass over the generated files failed.
280
280
  */
@@ -299,20 +299,6 @@ const diagnosticCode = {
299
299
  */
300
300
  const docsMajor = version.split(".")[0] ?? "5";
301
301
  /**
302
- * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
303
- *
304
- * @example
305
- * ```ts
306
- * const update = narrow(diagnostic, diagnosticCode.updateAvailable)
307
- * if (update) {
308
- * console.log(update.latestVersion)
309
- * }
310
- * ```
311
- */
312
- function narrow(diagnostic, code) {
313
- return diagnostic.code === code ? diagnostic : null;
314
- }
315
- /**
316
302
  * Builds a type guard that narrows a {@link Diagnostic} to the variant for `kind`. A diagnostic
317
303
  * with no `kind` is treated as a `problem`.
318
304
  */
@@ -434,9 +420,9 @@ const diagnosticCatalog = {
434
420
  cause: "A plugin was configured with options that cannot be honored, for example `output.mode: 'file'` paired with a `group` option.",
435
421
  fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option or use `output.mode: 'directory'`."
436
422
  },
437
- [diagnosticCode.hookFailed]: {
438
- title: "Hook failed",
439
- cause: "A post-generate shell hook (`hooks.done`) exited with a non-zero status.",
423
+ [diagnosticCode.postGenerateFailed]: {
424
+ title: "Post-generate command failed",
425
+ cause: "A post-generate command (`output.postGenerate`) exited with a non-zero status.",
440
426
  fix: "Check the command is installed and correct, and run it manually to see the error."
441
427
  },
442
428
  [diagnosticCode.formatFailed]: {
@@ -488,10 +474,6 @@ var Diagnostics = class Diagnostics {
488
474
  */
489
475
  static isPerformance = isPerformance;
490
476
  /**
491
- * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
492
- */
493
- static narrow = narrow;
494
- /**
495
477
  * An `Error` that carries a {@link Diagnostic}, so structured problems can flow
496
478
  * through the existing throw/catch paths while keeping their code and location.
497
479
  *
@@ -1319,7 +1301,8 @@ var KubbDriver = class {
1319
1301
  },
1320
1302
  exclude: [],
1321
1303
  override: []
1322
- }
1304
+ },
1305
+ resolver: this.#getDefaultResolver(rawPlugin.name)
1323
1306
  };
1324
1307
  }));
1325
1308
  for (const plugin of normalized) {
@@ -2159,10 +2142,10 @@ const logLevel = {
2159
2142
  verbose: 4
2160
2143
  };
2161
2144
  /**
2162
- * Defines a reporter. When the definition has a `drain`, the returned reporter buffers each value
2163
- * `report` returns and hands the array to `drain` once, then clears it. Without a `drain`, nothing
2164
- * is buffered. Wiring the reporter onto the run's hooks is the host's job, so the reporter only
2165
- * ever deals with a {@link GenerationResult}.
2145
+ * Defines a reporter. The returned reporter buffers each value `report` returns in order and, when
2146
+ * the definition has a `drain`, hands the array to `drain` once and then clears it. Wiring the
2147
+ * reporter onto the run's hooks is the host's job, so the reporter only ever deals with a
2148
+ * {@link GenerationResult}.
2166
2149
  *
2167
2150
  * @example
2168
2151
  * ```ts
@@ -2180,19 +2163,19 @@ const logLevel = {
2180
2163
  * ```
2181
2164
  */
2182
2165
  function createReporter(reporter) {
2183
- const reports = /* @__PURE__ */ new Set();
2166
+ const reports = [];
2184
2167
  return {
2185
2168
  name: reporter.name,
2186
2169
  async report(result, context) {
2187
2170
  const report = await reporter.report(result, context);
2188
- reports.add(report);
2171
+ if (reporter.drain) reports.push(report);
2189
2172
  },
2190
2173
  async drain(context) {
2191
- await reporter.drain?.(context, Array.from(reports));
2192
- reports.clear();
2174
+ await reporter.drain?.(context, [...reports]);
2175
+ reports.length = 0;
2193
2176
  },
2194
2177
  [Symbol.dispose]() {
2195
- reports.clear();
2178
+ reports.length = 0;
2196
2179
  }
2197
2180
  };
2198
2181
  }