@kubb/studio 5.5.4 → 5.5.6

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
@@ -583,7 +583,7 @@ function resolveAgentCapacity(env = process.env) {
583
583
  }
584
584
  //#endregion
585
585
  //#region package.json
586
- var version = "5.5.4";
586
+ var version = "5.5.6";
587
587
  //#endregion
588
588
  //#region src/operations/generations.ts
589
589
  const READ_CONCURRENCY = 50;
@@ -1029,6 +1029,7 @@ const connectWebSocketRpc = async ({ url, token, instanceId, local }) => {
1029
1029
  /**
1030
1030
  * Register a `kubb:hook:start` listener that spawns the requested command via tinyexec,
1031
1031
  * streams each stdout line as a `kubb:hook:line` event, and calls `kubb:hook:end` with the result.
1032
+ * A failure travels on `kubb:hook:end` only: the caller waiting on it reports `kubb:error` once.
1032
1033
  * Streaming the output lets Kubb Studio render live hook progress over the WebSocket connection.
1033
1034
  *
1034
1035
  * Returns a remover, so a session that runs one generation after another on the same emitter does
@@ -1061,7 +1062,6 @@ function setupHookListener(hooks, root, signal) {
1061
1062
  success: false,
1062
1063
  error
1063
1064
  });
1064
- await hooks.callHook("kubb:error", { error });
1065
1065
  return;
1066
1066
  }
1067
1067
  await hooks.callHook("kubb:hook:end", {
@@ -1081,7 +1081,6 @@ function setupHookListener(hooks, root, signal) {
1081
1081
  success: false,
1082
1082
  error
1083
1083
  });
1084
- await hooks.callHook("kubb:error", { error });
1085
1084
  }
1086
1085
  });
1087
1086
  }
@@ -1231,12 +1230,17 @@ async function generate({ config, hooks, signal }) {
1231
1230
  const line = typeof entry === "string" ? entry : entry.command;
1232
1231
  const [cmd, ...args] = tokenize(line);
1233
1232
  if (!cmd) continue;
1234
- await runHook({
1235
- hooks,
1236
- id: line,
1237
- command: cmd,
1238
- args
1239
- });
1233
+ try {
1234
+ await runHook({
1235
+ hooks,
1236
+ id: line,
1237
+ command: cmd,
1238
+ args
1239
+ });
1240
+ } catch (error) {
1241
+ await hooks.callHook("kubb:error", { error: toError(error) });
1242
+ throw error;
1243
+ }
1240
1244
  await hooks.callHook("kubb:success", { message: `${line} successfully executed` });
1241
1245
  }
1242
1246
  await hooks.callHook("kubb:hooks:end");