@kubb/core 5.0.0-beta.109 → 5.0.0-beta.110

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
@@ -157,7 +157,7 @@ function randomCliColor(text) {
157
157
  /**
158
158
  * Docs major version, derived from the package version so the link tracks the published major.
159
159
  */
160
- const docsMajor = "5.0.0-beta.109".split(".")[0] ?? "5";
160
+ const docsMajor = "5.0.0-beta.110".split(".")[0] ?? "5";
161
161
  /**
162
162
  * Builds a type guard that narrows a {@link Diagnostic} to the variant for `kind`. A diagnostic
163
163
  * with no `kind` is treated as a `problem`.
@@ -585,14 +585,18 @@ var Diagnostics = class Diagnostics {
585
585
  * Merges the `output.mode` default into the output config and validates the combination.
586
586
  * Throws `KUBB_INVALID_PLUGIN_OPTIONS` when `mode: 'file'` is paired with a `group` option,
587
587
  * since a single-file output has nothing to group.
588
+ *
589
+ * An omitted `mode` follows the shape of `path`: an extension means a single file, anything
590
+ * else is a directory. Plugin defaults such as `path: 'types'` name a directory, so they
591
+ * generate without the caller spelling out `mode`.
588
592
  */
589
593
  function normalizeOutput({ output, group, pluginName }) {
590
- const mode = output.mode ?? "file";
594
+ const mode = output.mode ?? (node_path.default.extname(output.path) ? "file" : "directory");
591
595
  if (mode === "file" && group) throw new Diagnostics.Error({
592
596
  code: require_usingCtx.diagnosticCode.invalidPluginOptions,
593
597
  severity: "error",
594
- message: `Plugin "${pluginName}" sets \`output.mode: 'file'\` but also configures a \`group\` option.`,
595
- help: "A single-file output has nothing to group. Remove the `group` option, or use `output.mode: 'directory'` to organize files into subdirectories.",
598
+ message: `Plugin "${pluginName}" resolves \`output.mode\` to 'file' but also configures a \`group\` option.`,
599
+ help: "A single-file output has nothing to group. Remove the `group` option, give `output.path` an extensionless directory name, or set `output.mode: 'directory'` explicitly.",
596
600
  location: { kind: "config" },
597
601
  plugin: pluginName
598
602
  });