@kubb/core 2.0.0-alpha.8 → 2.0.0-beta.1

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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  </p>
19
19
 
20
20
  <h4>
21
- <a href="https://codesandbox.io/s/github/kubb-project/kubb/tree/main/examples/typescript" target="_blank">View Demo</a>
21
+ <a href="https://codesandbox.io/s/github/kubb-project/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
22
22
  <span> · </span>
23
23
  <a href="https://kubb.dev/" target="_blank">Documentation</a>
24
24
  <span> · </span>
package/dist/index.cjs CHANGED
@@ -1237,6 +1237,9 @@ function hookFirst(promises, nullCheck = (state) => state !== null) {
1237
1237
  }
1238
1238
  return promise;
1239
1239
  }
1240
+ function hookParallel(promises) {
1241
+ return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
1242
+ }
1240
1243
 
1241
1244
  // src/PromiseManager.ts
1242
1245
  var _options2;
@@ -1253,6 +1256,9 @@ var PromiseManager = class {
1253
1256
  if (strategy === "first") {
1254
1257
  return hookFirst(promises, __privateGet(this, _options2).nullCheck);
1255
1258
  }
1259
+ if (strategy === "parallel") {
1260
+ return hookParallel(promises);
1261
+ }
1256
1262
  throw new Error(`${strategy} not implemented`);
1257
1263
  }
1258
1264
  };
@@ -1457,14 +1463,10 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1457
1463
  hookName,
1458
1464
  parameters
1459
1465
  }) {
1460
- const parallelPromises = [];
1461
- for (const plugin of __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
1462
- const promise = __privateMethod(this, _execute, execute_fn).call(this, { strategy: "hookParallel", hookName, parameters, plugin });
1463
- if (promise) {
1464
- parallelPromises.push(promise);
1465
- }
1466
- }
1467
- const results = await Promise.allSettled(parallelPromises);
1466
+ const promises = __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
1467
+ return () => __privateMethod(this, _execute, execute_fn).call(this, { strategy: "hookParallel", hookName, parameters, plugin });
1468
+ });
1469
+ const results = await __privateGet(this, _promiseManager).run("parallel", promises);
1468
1470
  results.forEach((result, index) => {
1469
1471
  if (isPromiseRejectedResult(result)) {
1470
1472
  const plugin = __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)[index];