@kubb/studio 5.21.2 → 5.23.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/dist/index.cjs CHANGED
@@ -303,7 +303,7 @@ function isPathInside(path, parent) {
303
303
  return rel !== "" && !rel.startsWith("..") && !(0, node_path.isAbsolute)(rel);
304
304
  }
305
305
  // package.json
306
- var version = "5.21.2";
306
+ var version = "5.23.0";
307
307
  // ../../internals/shared/src/constants.ts
308
308
  /**
309
309
  * Extensions `kubb` ships at its own version, so they count as installed without being a direct
@@ -1458,27 +1458,30 @@ function generationFailure(diagnostics) {
1458
1458
  return /* @__PURE__ */ new Error(`Generation failed: ${reasons.length} error${reasons.length === 1 ? "" : "s"}: ${reasons.join("; ")}`);
1459
1459
  }
1460
1460
  /**
1461
- * Runs one generation and returns the files it produced. The formatter, the linter, and
1462
- * `output.postGenerate` only run with `allowExec`. Throws when any plugin reports an error.
1461
+ * Generates the config at `only` and returns the files it produced. It shares schemas with the other `configs` that set
1462
+ * the same `shared.path`. The formatter, the linter, and `output.postGenerate` only run with `allowExec`. Throws when
1463
+ * any plugin reports an error.
1463
1464
  */
1464
- async function generate({ config, hooks, signal, allowExec, fileRefs }) {
1465
+ async function generate({ configs, only = 0, hooks, signal, allowExec, fileRefs }) {
1466
+ const config = configs[only];
1465
1467
  const output = allowExec ? config.output : {
1466
1468
  ...config.output,
1467
1469
  format: false,
1468
1470
  lint: false,
1469
1471
  postGenerate: []
1470
1472
  };
1471
- const kubb = (0, _kubb_core.createKubb)({
1473
+ const result = (await Array.fromAsync(_kubb_core.Kubb.generate(configs.with(only, {
1472
1474
  ...config,
1473
1475
  output
1474
- }, {
1476
+ }), {
1475
1477
  hooks,
1476
1478
  signal,
1477
- fileRefs
1478
- });
1479
- const result = await kubb.generate();
1479
+ fileRefs,
1480
+ only
1481
+ })))[0];
1482
+ if (result.error) throw result.error;
1480
1483
  if (!result.success) throw generationFailure(result.diagnostics);
1481
- const { storage, root } = kubb.config;
1484
+ const { storage, root } = result.kubb.config;
1482
1485
  return {
1483
1486
  storage,
1484
1487
  root,
@@ -2698,23 +2701,29 @@ var Agent = class extends capnweb.RpcTarget {
2698
2701
  message: getErrorMessage(error),
2699
2702
  code: _kubb_core.Diagnostics.code.gitInputFailed
2700
2703
  })) : void 0;
2701
- const run = () => generate({
2702
- config: {
2703
- ...config,
2704
+ const buildConfig = {
2705
+ ...config,
2706
+ root,
2707
+ input: checkout?.path ?? studioInput ?? config.input,
2708
+ output: mergeOutput({
2709
+ output: config.output,
2710
+ studio: patch?.output
2711
+ }),
2712
+ storage: outputRoot ? stagingStorage({
2704
2713
  root,
2705
- input: checkout?.path ?? studioInput ?? config.input,
2706
- output: mergeOutput({
2707
- output: config.output,
2708
- studio: patch?.output
2709
- }),
2710
- storage: outputRoot ? stagingStorage({
2711
- root,
2712
- directory: outputRoot
2713
- }) : (0, _kubb_core.fsStorage)(),
2714
- plugins: activePlugins,
2715
- adapter,
2716
- parsers
2717
- },
2714
+ directory: outputRoot
2715
+ }) : (0, _kubb_core.fsStorage)(),
2716
+ plugins: activePlugins,
2717
+ adapter,
2718
+ parsers
2719
+ };
2720
+ const buildConfigs = this.#sandbox || this.#managed ? [buildConfig] : configs.map((entry) => entry === config ? buildConfig : {
2721
+ ...entry,
2722
+ root
2723
+ });
2724
+ const run = () => generate({
2725
+ configs: buildConfigs,
2726
+ only: buildConfigs.indexOf(buildConfig),
2718
2727
  hooks: this.#options.hooks,
2719
2728
  signal,
2720
2729
  allowExec: this.#permissions.allowWrite && this.#permissions.allowExec,