@kubb/studio 5.5.4 → 5.5.5

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.js CHANGED
@@ -578,7 +578,7 @@ function resolveAgentCapacity(env = process.env) {
578
578
  }
579
579
  //#endregion
580
580
  //#region package.json
581
- var version = "5.5.4";
581
+ var version = "5.5.5";
582
582
  //#endregion
583
583
  //#region src/operations/generations.ts
584
584
  const READ_CONCURRENCY = 50;
@@ -1024,6 +1024,7 @@ const connectWebSocketRpc = async ({ url, token, instanceId, local }) => {
1024
1024
  /**
1025
1025
  * Register a `kubb:hook:start` listener that spawns the requested command via tinyexec,
1026
1026
  * streams each stdout line as a `kubb:hook:line` event, and calls `kubb:hook:end` with the result.
1027
+ * A failure travels on `kubb:hook:end` only: the caller waiting on it reports `kubb:error` once.
1027
1028
  * Streaming the output lets Kubb Studio render live hook progress over the WebSocket connection.
1028
1029
  *
1029
1030
  * Returns a remover, so a session that runs one generation after another on the same emitter does
@@ -1056,7 +1057,6 @@ function setupHookListener(hooks, root, signal) {
1056
1057
  success: false,
1057
1058
  error
1058
1059
  });
1059
- await hooks.callHook("kubb:error", { error });
1060
1060
  return;
1061
1061
  }
1062
1062
  await hooks.callHook("kubb:hook:end", {
@@ -1076,7 +1076,6 @@ function setupHookListener(hooks, root, signal) {
1076
1076
  success: false,
1077
1077
  error
1078
1078
  });
1079
- await hooks.callHook("kubb:error", { error });
1080
1079
  }
1081
1080
  });
1082
1081
  }
@@ -1226,12 +1225,17 @@ async function generate({ config, hooks, signal }) {
1226
1225
  const line = typeof entry === "string" ? entry : entry.command;
1227
1226
  const [cmd, ...args] = tokenize(line);
1228
1227
  if (!cmd) continue;
1229
- await runHook({
1230
- hooks,
1231
- id: line,
1232
- command: cmd,
1233
- args
1234
- });
1228
+ try {
1229
+ await runHook({
1230
+ hooks,
1231
+ id: line,
1232
+ command: cmd,
1233
+ args
1234
+ });
1235
+ } catch (error) {
1236
+ await hooks.callHook("kubb:error", { error: toError(error) });
1237
+ throw error;
1238
+ }
1235
1239
  await hooks.callHook("kubb:success", { message: `${line} successfully executed` });
1236
1240
  }
1237
1241
  await hooks.callHook("kubb:hooks:end");