@kubb/core 5.0.0-alpha.27 → 5.0.0-alpha.29
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/{PluginDriver-B12z6KO-.d.ts → PluginDriver-C6VX0skO.d.ts} +3 -3
- package/dist/hooks.d.ts +1 -1
- package/dist/index.cjs +23 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/defineResolver.ts +22 -7
- package/src/types.ts +2 -2
|
@@ -1091,11 +1091,11 @@ type Output<_TOptions = unknown> = {
|
|
|
1091
1091
|
/**
|
|
1092
1092
|
* Add a banner text in the beginning of every file
|
|
1093
1093
|
*/
|
|
1094
|
-
banner?: string | ((node
|
|
1094
|
+
banner?: string | ((node?: RootNode) => string);
|
|
1095
1095
|
/**
|
|
1096
1096
|
* Add a footer text in the beginning of every file
|
|
1097
1097
|
*/
|
|
1098
|
-
footer?: string | ((node
|
|
1098
|
+
footer?: string | ((node?: RootNode) => string);
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Whether to override existing external files if they already exist.
|
|
1101
1101
|
* @default false
|
|
@@ -1472,4 +1472,4 @@ declare class PluginDriver {
|
|
|
1472
1472
|
}
|
|
1473
1473
|
//#endregion
|
|
1474
1474
|
export { createStorage as $, PrinterFactoryOptions as A, ResolverPathParams as B, PluginLifecycle as C, Preset as D, PluginWithLifeCycle as E, ResolvePathOptions as F, UserPluginWithLifeCycle as G, UserGroup as H, ResolvePathParams as I, CoreGeneratorV2 as J, UserResolver as K, Resolver as L, ResolveBannerContext as M, ResolveNameParams as N, Presets as O, ResolveOptionsContext as P, Storage as Q, ResolverContext as R, PluginFactoryOptions as S, PluginParameter as T, UserLogger as U, UserConfig as V, UserPlugin as W, ReactGeneratorV2 as X, Generator as Y, defineGenerator as Z, LoggerOptions as _, AdapterSource as a, Plugin as b, Config as c, Group as d, formatters as et, Include as f, LoggerContext as g, Logger as h, AdapterFactoryOptions as i, AsyncEventEmitter as it, PrinterPartial as j, Printer$1 as k, DevtoolsOptions as l, InputPath as m, getMode as n, logLevel as nt, BarrelType as o, InputData as p, KubbEvents as q, Adapter as r, PossiblePromise as rt, CompatibilityPreset as s, PluginDriver as t, linters as tt, Exclude as u, Output as v, PluginLifecycleHooks as w, PluginContext as x, Override as y, ResolverFileParams as z };
|
|
1475
|
-
//# sourceMappingURL=PluginDriver-
|
|
1475
|
+
//# sourceMappingURL=PluginDriver-C6VX0skO.d.ts.map
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { S as PluginFactoryOptions, b as Plugin, t as PluginDriver } from "./PluginDriver-
|
|
2
|
+
import { S as PluginFactoryOptions, b as Plugin, t as PluginDriver } from "./PluginDriver-C6VX0skO.js";
|
|
3
3
|
import { FabricFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useDriver.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1419,7 +1419,7 @@ const fsStorage = createStorage(() => ({
|
|
|
1419
1419
|
}));
|
|
1420
1420
|
//#endregion
|
|
1421
1421
|
//#region package.json
|
|
1422
|
-
var version = "5.0.0-alpha.
|
|
1422
|
+
var version = "5.0.0-alpha.29";
|
|
1423
1423
|
//#endregion
|
|
1424
1424
|
//#region src/utils/diagnostics.ts
|
|
1425
1425
|
/**
|
|
@@ -1880,6 +1880,7 @@ function matchesOperationPattern(node, type, pattern) {
|
|
|
1880
1880
|
case "operationId": return !!node.operationId.match(pattern);
|
|
1881
1881
|
case "path": return !!node.path.match(pattern);
|
|
1882
1882
|
case "method": return !!node.method.toLowerCase().match(pattern);
|
|
1883
|
+
case "contentType": return !!node.requestBody?.contentType?.match(pattern);
|
|
1883
1884
|
default: return false;
|
|
1884
1885
|
}
|
|
1885
1886
|
}
|
|
@@ -2080,13 +2081,17 @@ function buildDefaultBanner({ title, description, version, config }) {
|
|
|
2080
2081
|
/**
|
|
2081
2082
|
* Default banner resolver — returns the banner string for a generated file.
|
|
2082
2083
|
*
|
|
2083
|
-
* -
|
|
2084
|
-
*
|
|
2084
|
+
* A user-supplied `output.banner` overrides the default Kubb "Generated by Kubb" notice.
|
|
2085
|
+
* When no `output.banner` is set, the Kubb notice is used (including `title` and `version`
|
|
2086
|
+
* from the OAS spec when a `node` is provided).
|
|
2087
|
+
*
|
|
2088
|
+
* - When `output.banner` is a function and `node` is provided, returns `output.banner(node)`.
|
|
2089
|
+
* - When `output.banner` is a function and `node` is absent, falls back to the Kubb notice.
|
|
2085
2090
|
* - When `output.banner` is a string, returns it directly.
|
|
2086
2091
|
* - When `config.output.defaultBanner` is `false`, returns `undefined`.
|
|
2087
|
-
* - Otherwise returns the
|
|
2092
|
+
* - Otherwise returns the Kubb "Generated by Kubb" notice.
|
|
2088
2093
|
*
|
|
2089
|
-
* @example String banner
|
|
2094
|
+
* @example String banner overrides default
|
|
2090
2095
|
* ```ts
|
|
2091
2096
|
* defaultResolveBanner(undefined, { output: { banner: '// my banner' }, config })
|
|
2092
2097
|
* // → '// my banner'
|
|
@@ -2098,17 +2103,27 @@ function buildDefaultBanner({ title, description, version, config }) {
|
|
|
2098
2103
|
* // → '// v3.0.0'
|
|
2099
2104
|
* ```
|
|
2100
2105
|
*
|
|
2101
|
-
* @example
|
|
2106
|
+
* @example No user banner — Kubb notice with OAS metadata
|
|
2107
|
+
* ```ts
|
|
2108
|
+
* defaultResolveBanner(rootNode, { config })
|
|
2109
|
+
* // → '/** Generated by Kubb ... Title: Pet Store ... *\/'
|
|
2110
|
+
* ```
|
|
2111
|
+
*
|
|
2112
|
+
* @example Disabled default banner
|
|
2102
2113
|
* ```ts
|
|
2103
2114
|
* defaultResolveBanner(undefined, { config: { output: { defaultBanner: false }, ...config } })
|
|
2104
2115
|
* // → undefined
|
|
2105
2116
|
* ```
|
|
2106
2117
|
*/
|
|
2107
2118
|
function defaultResolveBanner(node, { output, config }) {
|
|
2108
|
-
if (typeof output?.banner === "function") return
|
|
2119
|
+
if (typeof output?.banner === "function") return output.banner(node);
|
|
2109
2120
|
if (typeof output?.banner === "string") return output.banner;
|
|
2110
2121
|
if (config.output.defaultBanner === false) return;
|
|
2111
|
-
return buildDefaultBanner({
|
|
2122
|
+
return buildDefaultBanner({
|
|
2123
|
+
title: node?.meta?.title,
|
|
2124
|
+
version: node?.meta?.version,
|
|
2125
|
+
config
|
|
2126
|
+
});
|
|
2112
2127
|
}
|
|
2113
2128
|
/**
|
|
2114
2129
|
* Default footer resolver — returns the footer string for a generated file.
|