@kubb/adapter-oas 5.0.0-beta.40 → 5.0.0-beta.42
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 +11 -11
- package/dist/index.cjs +21 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter.bench.ts +1 -5
- package/src/adapter.ts +1 -7
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
[![npm version][npm-version-src]][npm-version-href]
|
|
7
7
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
8
|
-
[![
|
|
8
|
+
[![Stars][stars-src]][stars-href]
|
|
9
9
|
[![License][license-src]][license-href]
|
|
10
|
-
[![
|
|
10
|
+
[![Node][node-src]][node-href]
|
|
11
11
|
|
|
12
12
|
<h4>
|
|
13
13
|
<a href="https://kubb.dev" target="_blank">Documentation</a>
|
|
@@ -88,13 +88,13 @@ Kubb is an open source project, and its development is funded entirely by sponso
|
|
|
88
88
|
|
|
89
89
|
<!-- Badges -->
|
|
90
90
|
|
|
91
|
-
[npm-version-src]: https://
|
|
92
|
-
[npm-version-href]: https://
|
|
93
|
-
[npm-downloads-src]: https://
|
|
94
|
-
[npm-downloads-href]: https://
|
|
95
|
-
[
|
|
91
|
+
[npm-version-src]: https://shieldcn.dev/npm/v/@kubb/adapter-oas.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
92
|
+
[npm-version-href]: https://npmx.dev/package/@kubb/adapter-oas
|
|
93
|
+
[npm-downloads-src]: https://shieldcn.dev/npm/dm/@kubb/adapter-oas.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
94
|
+
[npm-downloads-href]: https://npmx.dev/package/@kubb/adapter-oas
|
|
95
|
+
[stars-src]: https://shieldcn.dev/github/stars/kubb-labs/kubb.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
96
|
+
[stars-href]: https://github.com/kubb-labs/kubb
|
|
97
|
+
[license-src]: https://shieldcn.dev/npm/license/@kubb/adapter-oas.svg?variant=secondary&size=xs&theme=zinc
|
|
96
98
|
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
100
|
-
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
|
99
|
+
[node-src]: https://shieldcn.dev/npm/node/@kubb/adapter-oas.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
100
|
+
[node-href]: https://npmx.dev/package/@kubb/adapter-oas
|
package/dist/index.cjs
CHANGED
|
@@ -230,6 +230,25 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
|
230
230
|
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
|
|
231
231
|
}
|
|
232
232
|
//#endregion
|
|
233
|
+
//#region ../../internals/utils/src/runtime.ts
|
|
234
|
+
/**
|
|
235
|
+
* Returns `true` when the current process is running under Bun.
|
|
236
|
+
*
|
|
237
|
+
* Detection keys off the global `Bun` object rather than `process.versions`,
|
|
238
|
+
* because Bun polyfills `process.versions.node` for Node compatibility and would
|
|
239
|
+
* otherwise look like Node.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* if (isBun()) {
|
|
244
|
+
* await Bun.write(path, data)
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
function isBun() {
|
|
249
|
+
return typeof Bun !== "undefined";
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
233
252
|
//#region ../../internals/utils/src/fs.ts
|
|
234
253
|
/**
|
|
235
254
|
* Resolves to `true` when the file or directory at `path` exists.
|
|
@@ -243,7 +262,7 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
|
243
262
|
* ```
|
|
244
263
|
*/
|
|
245
264
|
async function exists(path) {
|
|
246
|
-
if (
|
|
265
|
+
if (isBun()) return Bun.file(path).exists();
|
|
247
266
|
return (0, node_fs_promises.access)(path).then(() => true, () => false);
|
|
248
267
|
}
|
|
249
268
|
//#endregion
|
|
@@ -2566,12 +2585,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
|
|
|
2566
2585
|
},
|
|
2567
2586
|
async parse(source) {
|
|
2568
2587
|
const streamNode = await createStream(source);
|
|
2569
|
-
const
|
|
2570
|
-
const out = [];
|
|
2571
|
-
for await (const item of iter) out.push(item);
|
|
2572
|
-
return out;
|
|
2573
|
-
};
|
|
2574
|
-
const [schemas, operations] = await Promise.all([collect(streamNode.schemas), collect(streamNode.operations)]);
|
|
2588
|
+
const [schemas, operations] = await Promise.all([Array.fromAsync(streamNode.schemas), Array.fromAsync(streamNode.operations)]);
|
|
2575
2589
|
return _kubb_core.ast.createInput({
|
|
2576
2590
|
schemas,
|
|
2577
2591
|
operations,
|