@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.cjs
CHANGED
|
@@ -236,12 +236,23 @@ function getPrimarySuccessResponse(node) {
|
|
|
236
236
|
*
|
|
237
237
|
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
238
238
|
*/
|
|
239
|
-
function
|
|
239
|
+
function convert(text, pascal) {
|
|
240
240
|
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) => {
|
|
241
241
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
242
242
|
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
243
243
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
244
244
|
}
|
|
245
|
+
const cache = /* @__PURE__ */ new Map();
|
|
246
|
+
const cacheLimit = 1e4;
|
|
247
|
+
function toCamelOrPascal(text, pascal) {
|
|
248
|
+
const key = `${pascal ? "P" : "c"}${text}`;
|
|
249
|
+
const cached = cache.get(key);
|
|
250
|
+
if (cached !== void 0) return cached;
|
|
251
|
+
const result = convert(text, pascal);
|
|
252
|
+
if (cache.size >= cacheLimit) cache.clear();
|
|
253
|
+
cache.set(key, result);
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
245
256
|
/**
|
|
246
257
|
* Converts `text` to camelCase.
|
|
247
258
|
*
|
|
@@ -1430,7 +1441,7 @@ var compatibility = {
|
|
|
1430
1441
|
};
|
|
1431
1442
|
//#endregion
|
|
1432
1443
|
//#region package.json
|
|
1433
|
-
var version = "5.7.
|
|
1444
|
+
var version = "5.7.1";
|
|
1434
1445
|
//#endregion
|
|
1435
1446
|
//#region src/templates.ts
|
|
1436
1447
|
/** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
|