kubb 5.0.0-beta.9 → 5.0.0-beta.93
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/LICENSE +17 -10
- package/README.md +51 -45
- package/bin/kubb.js +11 -3
- package/dist/astro.cjs +4 -0
- package/dist/astro.d.ts +2 -0
- package/dist/astro.js +2 -0
- package/dist/config.cjs +3 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +2 -0
- package/dist/defineConfig-BCzzAVwJ.js +114 -0
- package/dist/defineConfig-BCzzAVwJ.js.map +1 -0
- package/dist/defineConfig-CG4ndZ9i.d.ts +62 -0
- package/dist/defineConfig-CzY_scM2.cjs +119 -0
- package/dist/defineConfig-CzY_scM2.cjs.map +1 -0
- package/dist/esbuild.cjs +4 -0
- package/dist/esbuild.d.ts +2 -0
- package/dist/esbuild.js +2 -0
- package/dist/farm.cjs +4 -0
- package/dist/farm.d.ts +2 -0
- package/dist/farm.js +2 -0
- package/dist/index.cjs +9 -78
- package/dist/index.d.ts +4 -44
- package/dist/index.js +3 -78
- package/dist/jsx/jsx-dev-runtime.cjs +9 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +1 -0
- package/dist/jsx/jsx-dev-runtime.js +2 -0
- package/dist/jsx/jsx-runtime.cjs +9 -0
- package/dist/jsx/jsx-runtime.d.ts +1 -0
- package/dist/jsx/jsx-runtime.js +2 -0
- package/dist/jsx.cjs +18 -0
- package/dist/jsx.d.ts +2 -0
- package/dist/jsx.js +3 -0
- package/dist/kit/testing.cjs +9 -0
- package/dist/kit/testing.d.ts +1 -0
- package/dist/kit/testing.js +2 -0
- package/dist/kit.cjs +9 -0
- package/dist/kit.d.ts +1 -0
- package/dist/kit.js +2 -0
- package/dist/nuxt.cjs +4 -0
- package/dist/nuxt.d.ts +2 -0
- package/dist/nuxt.js +2 -0
- package/dist/rolldown-runtime-Bx3C2hgW.cjs +38 -0
- package/dist/rolldown.cjs +4 -0
- package/dist/rolldown.d.ts +2 -0
- package/dist/rolldown.js +2 -0
- package/dist/rollup.cjs +4 -0
- package/dist/rollup.d.ts +2 -0
- package/dist/rollup.js +2 -0
- package/dist/rspack.cjs +4 -0
- package/dist/rspack.d.ts +2 -0
- package/dist/rspack.js +2 -0
- package/dist/vite.cjs +4 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.js +2 -0
- package/dist/webpack.cjs +4 -0
- package/dist/webpack.d.ts +2 -0
- package/dist/webpack.js +2 -0
- package/package.json +82 -35
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/src/defineConfig.ts +0 -91
- package/src/index.ts +0 -2
- /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,79 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* isPromise(Promise.resolve(1)) // true
|
|
12
|
-
* isPromise(42) // false
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function isPromise(result) {
|
|
16
|
-
return result !== null && result !== void 0 && typeof result["then"] === "function";
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/defineConfig.ts
|
|
20
|
-
/**
|
|
21
|
-
* Applies default adapter, parsers, middleware, `output.barrel`, `output.format`, and `output.lint` to a single user config when not set.
|
|
22
|
-
*
|
|
23
|
-
* - `adapter` defaults to `adapterOas()`
|
|
24
|
-
* - `parsers` defaults to `[parserTs, parserTsx]`
|
|
25
|
-
* - `middleware` defaults to `[middlewareBarrel()]`
|
|
26
|
-
* - `output.barrel` defaults to `{ type: 'named' }` **only when `middlewareBarrel` is part of `middleware`**.
|
|
27
|
-
* When the user provides a custom middleware list without `middlewareBarrel`, `barrel` is left untouched.
|
|
28
|
-
* - `output.format` defaults to `'auto'`
|
|
29
|
-
* - `output.lint` defaults to `'auto'`
|
|
30
|
-
*/
|
|
31
|
-
function applyDefaults(config) {
|
|
32
|
-
const middleware = config.middleware?.length ? config.middleware : [(0, _kubb_middleware_barrel.middlewareBarrel)()];
|
|
33
|
-
const hasBarrelMiddleware = middleware.some((m) => m.name === _kubb_middleware_barrel.middlewareBarrelName);
|
|
34
|
-
const output = { ...config.output };
|
|
35
|
-
if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
|
|
36
|
-
if (output.format === void 0) output.format = false;
|
|
37
|
-
if (output.lint === void 0) output.lint = false;
|
|
38
|
-
return {
|
|
39
|
-
...config,
|
|
40
|
-
adapter: config.adapter ?? (0, _kubb_adapter_oas.adapterOas)(),
|
|
41
|
-
parsers: config.parsers?.length ? config.parsers : [_kubb_parser_ts.parserTs, _kubb_parser_ts.parserTsx],
|
|
42
|
-
middleware,
|
|
43
|
-
output
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function normalizeConfig(config) {
|
|
47
|
-
if (Array.isArray(config)) return config.map(applyDefaults);
|
|
48
|
-
return applyDefaults(config);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Helper for defining a Kubb configuration with built-in defaults.
|
|
52
|
-
*
|
|
53
|
-
* When no `adapter` is provided, `adapterOas()` is used automatically.
|
|
54
|
-
* When no `parsers` are provided, `[parserTs, parserTsx]` is used automatically.
|
|
55
|
-
*
|
|
56
|
-
* Accepts either:
|
|
57
|
-
* - A config object or array of configs
|
|
58
|
-
* - A function returning the config(s), optionally async,
|
|
59
|
-
* receiving the CLI options as argument
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* export default defineConfig(({ logLevel }) => ({
|
|
64
|
-
* root: 'src',
|
|
65
|
-
* plugins: [myPlugin()],
|
|
66
|
-
* }))
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
function defineConfig(config) {
|
|
70
|
-
if (typeof config === "function") return (async (cli) => {
|
|
71
|
-
return normalizeConfig(await config(cli));
|
|
72
|
-
});
|
|
73
|
-
if (isPromise(config)) return config.then((resolved) => normalizeConfig(resolved));
|
|
74
|
-
return normalizeConfig(config);
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
exports.defineConfig = defineConfig;
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=index.cjs.map
|
|
2
|
+
const require_defineConfig = require("./defineConfig-CzY_scM2.cjs");
|
|
3
|
+
let _kubb_core = require("@kubb/core");
|
|
4
|
+
Object.defineProperty(exports, "createKubb", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return _kubb_core.createKubb;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
exports.defineConfig = require_defineConfig.defineConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
//#region ../../internals/utils/src/promise.d.ts
|
|
6
|
-
/** A value that may already be resolved or still pending.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* function load(id: string): PossiblePromise<string> {
|
|
11
|
-
* return cache.get(id) ?? fetchRemote(id)
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
type PossiblePromise<T> = Promise<T> | T;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/defineConfig.d.ts
|
|
18
|
-
type AnyConfigResult = UserConfig<any> | Array<UserConfig<any>>;
|
|
19
|
-
type ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>);
|
|
20
|
-
type NormalizeConfig<TConfig> = TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never;
|
|
21
|
-
type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOptions) => PossiblePromise<infer TResult>) ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>> : TConfig extends Promise<infer TResult> ? Promise<NormalizeConfig<TResult>> : NormalizeConfig<TConfig>;
|
|
22
|
-
/**
|
|
23
|
-
* Helper for defining a Kubb configuration with built-in defaults.
|
|
24
|
-
*
|
|
25
|
-
* When no `adapter` is provided, `adapterOas()` is used automatically.
|
|
26
|
-
* When no `parsers` are provided, `[parserTs, parserTsx]` is used automatically.
|
|
27
|
-
*
|
|
28
|
-
* Accepts either:
|
|
29
|
-
* - A config object or array of configs
|
|
30
|
-
* - A function returning the config(s), optionally async,
|
|
31
|
-
* receiving the CLI options as argument
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* export default defineConfig(({ logLevel }) => ({
|
|
36
|
-
* root: 'src',
|
|
37
|
-
* plugins: [myPlugin()],
|
|
38
|
-
* }))
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
declare function defineConfig<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig>;
|
|
42
|
-
//#endregion
|
|
43
|
-
export { type BarrelType, defineConfig };
|
|
44
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { t as defineConfig } from "./defineConfig-CG4ndZ9i.js";
|
|
2
|
+
import { BuildOutput, Config, CreateKubbOptions, Kubb, UserConfig, createKubb } from "@kubb/core";
|
|
3
|
+
import { BarrelType } from "@kubb/plugin-barrel";
|
|
4
|
+
export { type BarrelType, type BuildOutput, type Config, type CreateKubbOptions, type Kubb, type UserConfig, createKubb, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,78 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { parserTs, parserTsx } from "@kubb/parser-ts";
|
|
5
|
-
//#region ../../internals/utils/src/promise.ts
|
|
6
|
-
/** Returns `true` when `result` is a thenable `Promise`.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* isPromise(Promise.resolve(1)) // true
|
|
11
|
-
* isPromise(42) // false
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
function isPromise(result) {
|
|
15
|
-
return result !== null && result !== void 0 && typeof result["then"] === "function";
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/defineConfig.ts
|
|
19
|
-
/**
|
|
20
|
-
* Applies default adapter, parsers, middleware, `output.barrel`, `output.format`, and `output.lint` to a single user config when not set.
|
|
21
|
-
*
|
|
22
|
-
* - `adapter` defaults to `adapterOas()`
|
|
23
|
-
* - `parsers` defaults to `[parserTs, parserTsx]`
|
|
24
|
-
* - `middleware` defaults to `[middlewareBarrel()]`
|
|
25
|
-
* - `output.barrel` defaults to `{ type: 'named' }` **only when `middlewareBarrel` is part of `middleware`**.
|
|
26
|
-
* When the user provides a custom middleware list without `middlewareBarrel`, `barrel` is left untouched.
|
|
27
|
-
* - `output.format` defaults to `'auto'`
|
|
28
|
-
* - `output.lint` defaults to `'auto'`
|
|
29
|
-
*/
|
|
30
|
-
function applyDefaults(config) {
|
|
31
|
-
const middleware = config.middleware?.length ? config.middleware : [middlewareBarrel()];
|
|
32
|
-
const hasBarrelMiddleware = middleware.some((m) => m.name === middlewareBarrelName);
|
|
33
|
-
const output = { ...config.output };
|
|
34
|
-
if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
|
|
35
|
-
if (output.format === void 0) output.format = false;
|
|
36
|
-
if (output.lint === void 0) output.lint = false;
|
|
37
|
-
return {
|
|
38
|
-
...config,
|
|
39
|
-
adapter: config.adapter ?? adapterOas(),
|
|
40
|
-
parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx],
|
|
41
|
-
middleware,
|
|
42
|
-
output
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function normalizeConfig(config) {
|
|
46
|
-
if (Array.isArray(config)) return config.map(applyDefaults);
|
|
47
|
-
return applyDefaults(config);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Helper for defining a Kubb configuration with built-in defaults.
|
|
51
|
-
*
|
|
52
|
-
* When no `adapter` is provided, `adapterOas()` is used automatically.
|
|
53
|
-
* When no `parsers` are provided, `[parserTs, parserTsx]` is used automatically.
|
|
54
|
-
*
|
|
55
|
-
* Accepts either:
|
|
56
|
-
* - A config object or array of configs
|
|
57
|
-
* - A function returning the config(s), optionally async,
|
|
58
|
-
* receiving the CLI options as argument
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* export default defineConfig(({ logLevel }) => ({
|
|
63
|
-
* root: 'src',
|
|
64
|
-
* plugins: [myPlugin()],
|
|
65
|
-
* }))
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
function defineConfig(config) {
|
|
69
|
-
if (typeof config === "function") return (async (cli) => {
|
|
70
|
-
return normalizeConfig(await config(cli));
|
|
71
|
-
});
|
|
72
|
-
if (isPromise(config)) return config.then((resolved) => normalizeConfig(resolved));
|
|
73
|
-
return normalizeConfig(config);
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
76
|
-
export { defineConfig };
|
|
77
|
-
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { t as defineConfig } from "./defineConfig-BCzzAVwJ.js";
|
|
2
|
+
import { createKubb } from "@kubb/core";
|
|
3
|
+
export { createKubb, defineConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _kubb_renderer_jsx_jsx_dev_runtime = require("@kubb/renderer-jsx/jsx-dev-runtime");
|
|
2
|
+
Object.keys(_kubb_renderer_jsx_jsx_dev_runtime).forEach(function(k) {
|
|
3
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _kubb_renderer_jsx_jsx_dev_runtime[k];
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@kubb/renderer-jsx/jsx-dev-runtime";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
2
|
+
Object.keys(_kubb_renderer_jsx_jsx_runtime).forEach(function(k) {
|
|
3
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _kubb_renderer_jsx_jsx_runtime[k];
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@kubb/renderer-jsx/jsx-runtime";
|
package/dist/jsx.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
2
|
+
Object.keys(_kubb_renderer_jsx).forEach(function(k) {
|
|
3
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _kubb_renderer_jsx[k];
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
var _kubb_renderer_jsx_types = require("@kubb/renderer-jsx/types");
|
|
11
|
+
Object.keys(_kubb_renderer_jsx_types).forEach(function(k) {
|
|
12
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return _kubb_renderer_jsx_types[k];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
package/dist/jsx.d.ts
ADDED
package/dist/jsx.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _kubb_kit_testing = require("@kubb/kit/testing");
|
|
2
|
+
Object.keys(_kubb_kit_testing).forEach(function(k) {
|
|
3
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _kubb_kit_testing[k];
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@kubb/kit/testing";
|
package/dist/kit.cjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _kubb_kit = require("@kubb/kit");
|
|
2
|
+
Object.keys(_kubb_kit).forEach(function(k) {
|
|
3
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _kubb_kit[k];
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
package/dist/kit.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@kubb/kit";
|
package/dist/kit.js
ADDED
package/dist/nuxt.cjs
ADDED
package/dist/nuxt.d.ts
ADDED
package/dist/nuxt.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
Object.defineProperty(exports, "__name", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return __name;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "__toESM", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return __toESM;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bx3C2hgW.cjs");
|
|
2
|
+
let unplugin_kubb_rolldown = require("unplugin-kubb/rolldown");
|
|
3
|
+
unplugin_kubb_rolldown = require_rolldown_runtime.__toESM(unplugin_kubb_rolldown, 1);
|
|
4
|
+
module.exports = unplugin_kubb_rolldown.default;
|
package/dist/rolldown.js
ADDED
package/dist/rollup.cjs
ADDED
package/dist/rollup.d.ts
ADDED
package/dist/rollup.js
ADDED
package/dist/rspack.cjs
ADDED
package/dist/rspack.d.ts
ADDED
package/dist/rspack.js
ADDED
package/dist/vite.cjs
ADDED
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
package/dist/webpack.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Bx3C2hgW.cjs");
|
|
2
|
+
let unplugin_kubb_webpack = require("unplugin-kubb/webpack");
|
|
3
|
+
unplugin_kubb_webpack = require_rolldown_runtime.__toESM(unplugin_kubb_webpack, 1);
|
|
4
|
+
module.exports = unplugin_kubb_webpack.default;
|
package/dist/webpack.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kubb",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.0-beta.93",
|
|
4
|
+
"description": "The meta framework for code generation. Point Kubb at a schema and it generates types, clients, hooks, validators, mocks, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
7
7
|
"code-generator",
|
|
@@ -10,12 +10,8 @@
|
|
|
10
10
|
"kubb",
|
|
11
11
|
"meta-framework",
|
|
12
12
|
"msw",
|
|
13
|
-
"openapi",
|
|
14
13
|
"plugin-system",
|
|
15
|
-
"react-query",
|
|
16
14
|
"sdk-generator",
|
|
17
|
-
"swagger",
|
|
18
|
-
"tanstack-query",
|
|
19
15
|
"typescript",
|
|
20
16
|
"zod"
|
|
21
17
|
],
|
|
@@ -30,7 +26,6 @@
|
|
|
30
26
|
"kubb": "bin/kubb.js"
|
|
31
27
|
},
|
|
32
28
|
"files": [
|
|
33
|
-
"src",
|
|
34
29
|
"dist",
|
|
35
30
|
"bin",
|
|
36
31
|
"!/**/**.test.**",
|
|
@@ -47,6 +42,66 @@
|
|
|
47
42
|
"import": "./dist/index.js",
|
|
48
43
|
"require": "./dist/index.cjs"
|
|
49
44
|
},
|
|
45
|
+
"./astro": {
|
|
46
|
+
"import": "./dist/astro.js",
|
|
47
|
+
"require": "./dist/astro.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./config": {
|
|
50
|
+
"import": "./dist/config.js",
|
|
51
|
+
"require": "./dist/config.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./esbuild": {
|
|
54
|
+
"import": "./dist/esbuild.js",
|
|
55
|
+
"require": "./dist/esbuild.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./farm": {
|
|
58
|
+
"import": "./dist/farm.js",
|
|
59
|
+
"require": "./dist/farm.cjs"
|
|
60
|
+
},
|
|
61
|
+
"./jsx": {
|
|
62
|
+
"import": "./dist/jsx.js",
|
|
63
|
+
"require": "./dist/jsx.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./jsx/jsx-dev-runtime": {
|
|
66
|
+
"import": "./dist/jsx/jsx-dev-runtime.js",
|
|
67
|
+
"require": "./dist/jsx/jsx-dev-runtime.cjs"
|
|
68
|
+
},
|
|
69
|
+
"./jsx/jsx-runtime": {
|
|
70
|
+
"import": "./dist/jsx/jsx-runtime.js",
|
|
71
|
+
"require": "./dist/jsx/jsx-runtime.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./kit": {
|
|
74
|
+
"import": "./dist/kit.js",
|
|
75
|
+
"require": "./dist/kit.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./kit/testing": {
|
|
78
|
+
"import": "./dist/kit/testing.js",
|
|
79
|
+
"require": "./dist/kit/testing.cjs"
|
|
80
|
+
},
|
|
81
|
+
"./nuxt": {
|
|
82
|
+
"import": "./dist/nuxt.js",
|
|
83
|
+
"require": "./dist/nuxt.cjs"
|
|
84
|
+
},
|
|
85
|
+
"./rolldown": {
|
|
86
|
+
"import": "./dist/rolldown.js",
|
|
87
|
+
"require": "./dist/rolldown.cjs"
|
|
88
|
+
},
|
|
89
|
+
"./rollup": {
|
|
90
|
+
"import": "./dist/rollup.js",
|
|
91
|
+
"require": "./dist/rollup.cjs"
|
|
92
|
+
},
|
|
93
|
+
"./rspack": {
|
|
94
|
+
"import": "./dist/rspack.js",
|
|
95
|
+
"require": "./dist/rspack.cjs"
|
|
96
|
+
},
|
|
97
|
+
"./vite": {
|
|
98
|
+
"import": "./dist/vite.js",
|
|
99
|
+
"require": "./dist/vite.cjs"
|
|
100
|
+
},
|
|
101
|
+
"./webpack": {
|
|
102
|
+
"import": "./dist/webpack.js",
|
|
103
|
+
"require": "./dist/webpack.cjs"
|
|
104
|
+
},
|
|
50
105
|
"./package.json": "./package.json"
|
|
51
106
|
},
|
|
52
107
|
"publishConfig": {
|
|
@@ -54,47 +109,39 @@
|
|
|
54
109
|
"registry": "https://registry.npmjs.org/"
|
|
55
110
|
},
|
|
56
111
|
"dependencies": {
|
|
57
|
-
"@kubb/adapter-oas": "5.0.0-beta.
|
|
58
|
-
"@kubb/
|
|
59
|
-
"@kubb/core": "5.0.0-beta.
|
|
60
|
-
"@kubb/
|
|
61
|
-
"@kubb/
|
|
62
|
-
"@kubb/
|
|
112
|
+
"@kubb/adapter-oas": "5.0.0-beta.93",
|
|
113
|
+
"@kubb/kit": "5.0.0-beta.93",
|
|
114
|
+
"@kubb/core": "5.0.0-beta.93",
|
|
115
|
+
"@kubb/mcp": "5.0.0-beta.93",
|
|
116
|
+
"@kubb/cli": "5.0.0-beta.93",
|
|
117
|
+
"@kubb/parser-md": "5.0.0-beta.93",
|
|
118
|
+
"@kubb/ast": "5.0.0-beta.93",
|
|
119
|
+
"@kubb/parser-ts": "5.0.0-beta.93",
|
|
120
|
+
"@kubb/plugin-barrel": "5.0.0-beta.93",
|
|
121
|
+
"@kubb/renderer-jsx": "5.0.0-beta.93",
|
|
122
|
+
"unplugin-kubb": "5.0.0-beta.93"
|
|
63
123
|
},
|
|
64
124
|
"devDependencies": {
|
|
125
|
+
"@farmfe/core": "^1.7.11",
|
|
126
|
+
"@nuxt/kit": "^4.4.8",
|
|
127
|
+
"@nuxt/schema": "^4.4.8",
|
|
128
|
+
"esbuild": "^0.28.1",
|
|
129
|
+
"rolldown": "^1.1.4",
|
|
130
|
+
"rollup": "^4.62.2",
|
|
65
131
|
"typescript": "^6.0.3",
|
|
132
|
+
"vite": "^8.1.3",
|
|
133
|
+
"webpack": "^5.108.4",
|
|
66
134
|
"@internals/utils": "0.0.0"
|
|
67
135
|
},
|
|
68
|
-
"peerDependencies": {
|
|
69
|
-
"@kubb/agent": "5.0.0-beta.9",
|
|
70
|
-
"@kubb/mcp": "5.0.0-beta.9"
|
|
71
|
-
},
|
|
72
|
-
"peerDependenciesMeta": {
|
|
73
|
-
"@kubb/agent": {
|
|
74
|
-
"optional": true
|
|
75
|
-
},
|
|
76
|
-
"@kubb/mcp": {
|
|
77
|
-
"optional": true
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"size-limit": [
|
|
81
|
-
{
|
|
82
|
-
"path": "./dist/*.js",
|
|
83
|
-
"limit": "510 KiB",
|
|
84
|
-
"gzip": true
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
136
|
"preferGlobal": true,
|
|
88
137
|
"engines": {
|
|
89
138
|
"node": ">=22"
|
|
90
139
|
},
|
|
91
140
|
"scripts": {
|
|
92
141
|
"build": "tsdown",
|
|
93
|
-
"clean": "
|
|
142
|
+
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
94
143
|
"lint": "oxlint .",
|
|
95
144
|
"lint:fix": "oxlint --fix .",
|
|
96
|
-
"release": "pnpm publish --no-git-check",
|
|
97
|
-
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
98
145
|
"start": "tsdown --watch",
|
|
99
146
|
"test": "vitest --passWithNoTests",
|
|
100
147
|
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["middlewareBarrelName","parserTs","parserTsx"],"sources":["../../../internals/utils/src/promise.ts","../src/defineConfig.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\n/** Returns `true` when `result` is a thenable `Promise`.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve(1)) // true\n * isPromise(42) // false\n * ```\n */\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return result !== null && result !== undefined && typeof (result as Record<string, unknown>)['then'] === 'function'\n}\n\n/** Returns `true` when `result` is a fulfilled `Promise.allSettled` result.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseFulfilledResult).map((r) => r.value)\n * ```\n */\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\n/** Returns `true` when `result` is a rejected `Promise.allSettled` result with a typed `reason`.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseRejectedResult<Error>).map((r) => r.reason.message)\n * ```\n */\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import { isPromise, type PossiblePromise } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport type { CLIOptions, UserConfig } from '@kubb/core'\nimport { middlewareBarrel, middlewareBarrelName } from '@kubb/middleware-barrel'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\n\ntype AnyConfigResult = UserConfig<any> | Array<UserConfig<any>>\ntype ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>)\ntype NormalizeConfig<TConfig> =\n TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never\ntype DefinedConfig<TConfig extends ConfigInput> = TConfig extends (cli: CLIOptions) => PossiblePromise<infer TResult>\n ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>>\n : TConfig extends Promise<infer TResult>\n ? Promise<NormalizeConfig<TResult>>\n : NormalizeConfig<TConfig>\n\n/**\n * Applies default adapter, parsers, middleware, `output.barrel`, `output.format`, and `output.lint` to a single user config when not set.\n *\n * - `adapter` defaults to `adapterOas()`\n * - `parsers` defaults to `[parserTs, parserTsx]`\n * - `middleware` defaults to `[middlewareBarrel()]`\n * - `output.barrel` defaults to `{ type: 'named' }` **only when `middlewareBarrel` is part of `middleware`**.\n * When the user provides a custom middleware list without `middlewareBarrel`, `barrel` is left untouched.\n * - `output.format` defaults to `'auto'`\n * - `output.lint` defaults to `'auto'`\n */\nfunction applyDefaults<TInput>(config: UserConfig<TInput>): UserConfig<TInput> {\n const middleware = config.middleware?.length ? config.middleware : [middlewareBarrel()]\n const hasBarrelMiddleware = middleware.some((m) => m.name === middlewareBarrelName)\n\n const output = { ...config.output }\n if (hasBarrelMiddleware && output.barrel === undefined) {\n output.barrel = { type: 'named' }\n }\n if (output.format === undefined) {\n output.format = false\n }\n if (output.lint === undefined) {\n output.lint = false\n }\n\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx],\n middleware,\n output,\n }\n}\n\nfunction normalizeConfig<TInput>(config: UserConfig<TInput> | Array<UserConfig<TInput>>): UserConfig<TInput> | Array<UserConfig<TInput>> {\n if (Array.isArray(config)) {\n return config.map(applyDefaults)\n }\n\n return applyDefaults(config)\n}\n\n/**\n * Helper for defining a Kubb configuration with built-in defaults.\n *\n * When no `adapter` is provided, `adapterOas()` is used automatically.\n * When no `parsers` are provided, `[parserTs, parserTsx]` is used automatically.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * ```ts\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n * ```\n */\nexport function defineConfig<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig> {\n if (typeof config === 'function') {\n return (async (cli: CLIOptions) => {\n return normalizeConfig(await config(cli))\n }) as DefinedConfig<TConfig>\n }\n\n if (isPromise(config)) {\n return config.then((resolved) => normalizeConfig(resolved)) as DefinedConfig<TConfig>\n }\n\n return normalizeConfig(config) as DefinedConfig<TConfig>\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,UAAa,QAAkD;CAC7E,OAAO,WAAW,QAAQ,WAAW,KAAA,KAAa,OAAQ,OAAmC,YAAY;;;;;;;;;;;;;;;ACO3G,SAAS,cAAsB,QAAgD;CAC7E,MAAM,aAAa,OAAO,YAAY,SAAS,OAAO,aAAa,EAAA,GAAA,wBAAA,mBAAmB,CAAC;CACvF,MAAM,sBAAsB,WAAW,MAAM,MAAM,EAAE,SAASA,wBAAAA,qBAAqB;CAEnF,MAAM,SAAS,EAAE,GAAG,OAAO,QAAQ;CACnC,IAAI,uBAAuB,OAAO,WAAW,KAAA,GAC3C,OAAO,SAAS,EAAE,MAAM,SAAS;CAEnC,IAAI,OAAO,WAAW,KAAA,GACpB,OAAO,SAAS;CAElB,IAAI,OAAO,SAAS,KAAA,GAClB,OAAO,OAAO;CAGhB,OAAO;EACL,GAAG;EACH,SAAS,OAAO,YAAA,GAAA,kBAAA,aAAuB;EACvC,SAAS,OAAO,SAAS,SAAS,OAAO,UAAU,CAACC,gBAAAA,UAAUC,gBAAAA,UAAU;EACxE;EACA;EACD;;AAGH,SAAS,gBAAwB,QAAwG;CACvI,IAAI,MAAM,QAAQ,OAAO,EACvB,OAAO,OAAO,IAAI,cAAc;CAGlC,OAAO,cAAc,OAAO;;;;;;;;;;;;;;;;;;;;;AAsB9B,SAAgB,aAA0C,QAAyC;CACjG,IAAI,OAAO,WAAW,YACpB,QAAQ,OAAO,QAAoB;EACjC,OAAO,gBAAgB,MAAM,OAAO,IAAI,CAAC;;CAI7C,IAAI,UAAU,OAAO,EACnB,OAAO,OAAO,MAAM,aAAa,gBAAgB,SAAS,CAAC;CAG7D,OAAO,gBAAgB,OAAO"}
|