@kubb/adapter-oas 5.0.0-beta.41 → 5.0.0-beta.43

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
@@ -204,6 +204,25 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
204
204
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
205
205
  }
206
206
  //#endregion
207
+ //#region ../../internals/utils/src/runtime.ts
208
+ /**
209
+ * Returns `true` when the current process is running under Bun.
210
+ *
211
+ * Detection keys off the global `Bun` object rather than `process.versions`,
212
+ * because Bun polyfills `process.versions.node` for Node compatibility and would
213
+ * otherwise look like Node.
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * if (isBun()) {
218
+ * await Bun.write(path, data)
219
+ * }
220
+ * ```
221
+ */
222
+ function isBun() {
223
+ return typeof Bun !== "undefined";
224
+ }
225
+ //#endregion
207
226
  //#region ../../internals/utils/src/fs.ts
208
227
  /**
209
228
  * Resolves to `true` when the file or directory at `path` exists.
@@ -217,7 +236,7 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
217
236
  * ```
218
237
  */
219
238
  async function exists(path) {
220
- if (typeof Bun !== "undefined") return Bun.file(path).exists();
239
+ if (isBun()) return Bun.file(path).exists();
221
240
  return access(path).then(() => true, () => false);
222
241
  }
223
242
  //#endregion
@@ -2540,12 +2559,7 @@ const adapterOas = createAdapter((options) => {
2540
2559
  },
2541
2560
  async parse(source) {
2542
2561
  const streamNode = await createStream(source);
2543
- const collect = async (iter) => {
2544
- const out = [];
2545
- for await (const item of iter) out.push(item);
2546
- return out;
2547
- };
2548
- const [schemas, operations] = await Promise.all([collect(streamNode.schemas), collect(streamNode.operations)]);
2562
+ const [schemas, operations] = await Promise.all([Array.fromAsync(streamNode.schemas), Array.fromAsync(streamNode.operations)]);
2549
2563
  return ast.createInput({
2550
2564
  schemas,
2551
2565
  operations,