@kubb/plugin-fetch 5.7.0-canary.20261016T084648 → 5.7.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/dist/index.cjs +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/templates/fetch.d.ts +4 -0
- package/docs/guides/transport.md +12 -0
- package/kubb-extension.json +41 -0
- package/package.json +8 -8
- package/templates/fetch.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -210,12 +210,23 @@ function getPrimarySuccessResponse(node) {
|
|
|
210
210
|
*
|
|
211
211
|
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
212
212
|
*/
|
|
213
|
-
function
|
|
213
|
+
function convert(text, pascal) {
|
|
214
214
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
215
215
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
216
216
|
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
217
217
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
218
218
|
}
|
|
219
|
+
const cache = /* @__PURE__ */ new Map();
|
|
220
|
+
const cacheLimit = 1e4;
|
|
221
|
+
function toCamelOrPascal(text, pascal) {
|
|
222
|
+
const key = `${pascal ? "P" : "c"}${text}`;
|
|
223
|
+
const cached = cache.get(key);
|
|
224
|
+
if (cached !== void 0) return cached;
|
|
225
|
+
const result = convert(text, pascal);
|
|
226
|
+
if (cache.size >= cacheLimit) cache.clear();
|
|
227
|
+
cache.set(key, result);
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
219
230
|
/**
|
|
220
231
|
* Converts `text` to camelCase.
|
|
221
232
|
*
|
|
@@ -1404,7 +1415,7 @@ var compatibility = {
|
|
|
1404
1415
|
};
|
|
1405
1416
|
//#endregion
|
|
1406
1417
|
//#region package.json
|
|
1407
|
-
var version = "5.7.
|
|
1418
|
+
var version = "5.7.1";
|
|
1408
1419
|
//#endregion
|
|
1409
1420
|
//#region src/templates.ts
|
|
1410
1421
|
/** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
|