@kubb/core 2.2.0 → 2.2.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/{chunk-P2QIVQIF.cjs → chunk-CZFLDKR5.cjs} +4 -4
- package/dist/{chunk-AIG4R6NN.cjs → chunk-OI2AOR2F.cjs} +5 -4
- package/dist/chunk-OI2AOR2F.cjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/mocks.cjs +2 -2
- package/dist/transformers.cjs +5 -5
- package/dist/utils.cjs +4 -4
- package/package.json +4 -4
- package/dist/chunk-AIG4R6NN.cjs.map +0 -1
- /package/dist/{chunk-P2QIVQIF.cjs.map → chunk-CZFLDKR5.cjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOI2AOR2F_cjs = require('./chunk-OI2AOR2F.cjs');
|
|
4
4
|
var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
5
5
|
|
|
6
6
|
// src/utils/URLPath.ts
|
|
@@ -71,7 +71,7 @@ var URLPath = class {
|
|
|
71
71
|
let newPath = this.path.replaceAll("{", "${");
|
|
72
72
|
if (found) {
|
|
73
73
|
newPath = found.reduce((prev, curr) => {
|
|
74
|
-
const pathParam = replacer ? replacer(
|
|
74
|
+
const pathParam = replacer ? replacer(chunkOI2AOR2F_cjs.camelCase(curr)) : chunkOI2AOR2F_cjs.camelCase(curr);
|
|
75
75
|
const replacement = `\${${pathParam}}`;
|
|
76
76
|
return prev.replace(curr, replacement);
|
|
77
77
|
}, this.path);
|
|
@@ -87,7 +87,7 @@ var URLPath = class {
|
|
|
87
87
|
const params = {};
|
|
88
88
|
found.forEach((item) => {
|
|
89
89
|
item = item.replaceAll("{", "").replaceAll("}", "");
|
|
90
|
-
const pathParam = replacer ? replacer(
|
|
90
|
+
const pathParam = replacer ? replacer(chunkOI2AOR2F_cjs.camelCase(item)) : chunkOI2AOR2F_cjs.camelCase(item);
|
|
91
91
|
params[pathParam] = pathParam;
|
|
92
92
|
}, this.path);
|
|
93
93
|
return params;
|
|
@@ -103,4 +103,4 @@ var URLPath = class {
|
|
|
103
103
|
|
|
104
104
|
exports.URLPath = URLPath;
|
|
105
105
|
//# sourceMappingURL=out.js.map
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-CZFLDKR5.cjs.map
|
|
@@ -5,11 +5,11 @@ var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
|
5
5
|
// src/transformers/casing.ts
|
|
6
6
|
chunkKAA3L7N6_cjs.init_cjs_shims();
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/change-case@5.4.
|
|
8
|
+
// ../../node_modules/.pnpm/change-case@5.4.1/node_modules/change-case/dist/index.js
|
|
9
9
|
chunkKAA3L7N6_cjs.init_cjs_shims();
|
|
10
10
|
var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
11
11
|
var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
12
|
-
var SPLIT_SEPARATE_NUMBER_RE = /(
|
|
12
|
+
var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
13
13
|
var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
14
14
|
var SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
15
15
|
var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
@@ -33,7 +33,8 @@ function splitSeparateNumbers(value) {
|
|
|
33
33
|
const word = words[i];
|
|
34
34
|
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
35
35
|
if (match) {
|
|
36
|
-
|
|
36
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
37
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
return words;
|
|
@@ -109,4 +110,4 @@ function pascalCase2(text) {
|
|
|
109
110
|
exports.camelCase = camelCase2;
|
|
110
111
|
exports.pascalCase = pascalCase2;
|
|
111
112
|
//# sourceMappingURL=out.js.map
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-OI2AOR2F.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transformers/casing.ts","../../../node_modules/.pnpm/change-case@5.4.1/node_modules/change-case/src/index.ts"],"names":["camelCase","pascalCase"],"mappings":";;;;;AAAA;;;ACAA;AACA,IAAM,uBAAuB;AAC7B,IAAM,uBAAuB;AAG7B,IAAM,2BAA2B;AAGjC,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAG5B,IAAM,mCAAmC;AA+BnC,SAAU,MAAM,OAAa;AACjC,MAAI,SAAS,MAAM,KAAI;AAEvB,WAAS,OACN,QAAQ,sBAAsB,mBAAmB,EACjD,QAAQ,sBAAsB,mBAAmB;AAEpD,WAAS,OAAO,QAAQ,sBAAsB,IAAI;AAElD,MAAI,QAAQ;AACZ,MAAI,MAAM,OAAO;AAGjB,SAAO,OAAO,OAAO,KAAK,MAAM;AAAM;AACtC,MAAI,UAAU;AAAK,WAAO,CAAA;AAC1B,SAAO,OAAO,OAAO,MAAM,CAAC,MAAM;AAAM;AAExC,SAAO,OAAO,MAAM,OAAO,GAAG,EAAE,MAAM,KAAK;AAC7C;AAKM,SAAU,qBAAqB,OAAa;AAChD,QAAM,QAAQ,MAAM,KAAK;AACzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,QAAQ,yBAAyB,KAAK,IAAI;AAChD,QAAI,OAAO;AACT,YAAM,SAAS,MAAM,SAAS,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG;AACpD,YAAM,OAAO,GAAG,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ACA,OAAgC;AAEhC,SAAO,CAAC,MAAc,UAAiB;AACrC,UAAM,QAAQ,KAAK,CAAC;AACpB,UAAM,UACJ,QAAQ,KAAK,SAAS,OAAO,SAAS,MAAM,MAAM,QAAQ,MAAM,KAAK;AACvE,WAAO,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;EACtC;AACF;AAEA,SAAS,kBACP,OACA,UAAmB,CAAA,GAAE;AAErB,QAAM,UACJ,QAAQ,UAAU,QAAQ,kBAAkB,uBAAuB;AACrE,QAAM,mBACJ,QAAQ,oBAAoB;AAC9B,QAAM,mBACJ,QAAQ,oBAAoB;AAC9B,MAAI,cAAc;AAClB,MAAI,cAAc,MAAM;AAExB,SAAO,cAAc,MAAM,QAAQ;AACjC,UAAM,OAAO,MAAM,OAAO,WAAW;AACrC,QAAI,CAAC,iBAAiB,SAAS,IAAI;AAAG;AACtC;;AAGF,SAAO,cAAc,aAAa;AAChC,UAAM,QAAQ,cAAc;AAC5B,UAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,QAAI,CAAC,iBAAiB,SAAS,IAAI;AAAG;AACtC,kBAAc;;AAGhB,SAAO;IACL,MAAM,MAAM,GAAG,WAAW;IAC1B,QAAQ,MAAM,MAAM,aAAa,WAAW,CAAC;IAC7C,MAAM,MAAM,WAAW;;AAE3B;;;ADtRO,SAASA,WAAU,MAAsB;AAC9C,SAAO,UAAgB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AAChF;AAEO,SAASC,YAAW,MAAsB;AAC/C,SAAO,WAAiB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AACjF","sourcesContent":["import { camelCase as changeCaseCamel, pascalCase as changePascalCase } from 'change-case'\n\nexport function camelCase(text: string): string {\n return changeCaseCamel(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n\nexport function pascalCase(text: string): string {\n return changePascalCase(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n","// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(\\d)\\p{Ll}|(\\p{L})\\d/u;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options {\n locale?: Locale;\n split?: (value: string) => string[];\n /** @deprecated Pass `split: splitSeparateNumbers` instead. */\n separateNumbers?: boolean;\n delimiter?: string;\n prefixCharacters?: string;\n suffixCharacters?: string;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value: string) {\n let result = value.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value: string) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n const offset = match.index + (match[1] ?? match[2]).length;\n words.splice(i, 1, word.slice(0, offset), word.slice(offset));\n }\n }\n return words;\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction splitPrefixSuffix(\n input: string,\n options: Options = {},\n): [string, string[], string] {\n const splitFn =\n options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters =\n options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters =\n options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters.includes(char)) break;\n prefixIndex++;\n }\n\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters.includes(char)) break;\n suffixIndex = index;\n }\n\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var chunkCZFLDKR5_cjs = require('./chunk-CZFLDKR5.cjs');
|
|
6
6
|
var chunk5SUBV3F7_cjs = require('./chunk-5SUBV3F7.cjs');
|
|
7
7
|
var chunkOYDUQYAK_cjs = require('./chunk-OYDUQYAK.cjs');
|
|
8
8
|
require('./chunk-2UXXYHS6.cjs');
|
|
9
9
|
require('./chunk-KXP7HD6Z.cjs');
|
|
10
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-OI2AOR2F.cjs');
|
|
11
11
|
var chunkJSJ3NRBQ_cjs = require('./chunk-JSJ3NRBQ.cjs');
|
|
12
12
|
var chunkXX56SVPB_cjs = require('./chunk-XX56SVPB.cjs');
|
|
13
13
|
require('./chunk-DM53DOLW.cjs');
|
|
@@ -51,7 +51,7 @@ async function setup(options) {
|
|
|
51
51
|
const { config, logger = chunkJSJ3NRBQ_cjs.createLogger({ logLevel: chunkJSJ3NRBQ_cjs.LogLevel.silent }) } = options;
|
|
52
52
|
let count = 0;
|
|
53
53
|
try {
|
|
54
|
-
if (isInputPath(config) && !new
|
|
54
|
+
if (isInputPath(config) && !new chunkCZFLDKR5_cjs.URLPath(config.input.path).isURL) {
|
|
55
55
|
await chunkXX56SVPB_cjs.read(config.input.path);
|
|
56
56
|
}
|
|
57
57
|
} catch (e) {
|
package/dist/mocks.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require('./chunk-OYDUQYAK.cjs');
|
|
4
4
|
require('./chunk-2UXXYHS6.cjs');
|
|
5
5
|
require('./chunk-KXP7HD6Z.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkOI2AOR2F_cjs = require('./chunk-OI2AOR2F.cjs');
|
|
7
7
|
require('./chunk-JSJ3NRBQ.cjs');
|
|
8
8
|
require('./chunk-XX56SVPB.cjs');
|
|
9
9
|
require('./chunk-DM53DOLW.cjs');
|
|
@@ -14,7 +14,7 @@ chunkKAA3L7N6_cjs.init_cjs_shims();
|
|
|
14
14
|
var mockedPluginManager = {
|
|
15
15
|
resolveName: ({ name, type }) => {
|
|
16
16
|
if (type === "type") {
|
|
17
|
-
return
|
|
17
|
+
return chunkOI2AOR2F_cjs.pascalCase(name);
|
|
18
18
|
}
|
|
19
19
|
return name;
|
|
20
20
|
},
|
package/dist/transformers.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var chunk2UXXYHS6_cjs = require('./chunk-2UXXYHS6.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkOI2AOR2F_cjs = require('./chunk-OI2AOR2F.cjs');
|
|
7
7
|
var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
8
8
|
|
|
9
9
|
// src/transformers/index.ts
|
|
@@ -85,8 +85,8 @@ var transformers_default = {
|
|
|
85
85
|
JSDoc: {
|
|
86
86
|
createJSDocBlockText
|
|
87
87
|
},
|
|
88
|
-
camelCase:
|
|
89
|
-
pascalCase:
|
|
88
|
+
camelCase: chunkOI2AOR2F_cjs.camelCase,
|
|
89
|
+
pascalCase: chunkOI2AOR2F_cjs.pascalCase
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
Object.defineProperty(exports, "searchAndReplace", {
|
|
@@ -107,11 +107,11 @@ Object.defineProperty(exports, "trimExtName", {
|
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "camelCase", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkOI2AOR2F_cjs.camelCase; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "pascalCase", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkOI2AOR2F_cjs.pascalCase; }
|
|
115
115
|
});
|
|
116
116
|
exports.combineCodes = combineCodes;
|
|
117
117
|
exports.createIndent = createIndent;
|
package/dist/utils.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCZFLDKR5_cjs = require('./chunk-CZFLDKR5.cjs');
|
|
4
4
|
var chunkKXP7HD6Z_cjs = require('./chunk-KXP7HD6Z.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkOI2AOR2F_cjs = require('./chunk-OI2AOR2F.cjs');
|
|
6
6
|
var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
7
7
|
var naturalOrderby = require('natural-orderby');
|
|
8
8
|
|
|
@@ -35,7 +35,7 @@ var FunctionParams = class {
|
|
|
35
35
|
acc.push(`${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
36
36
|
return acc;
|
|
37
37
|
}
|
|
38
|
-
const parameterName = name.startsWith("{") ? name :
|
|
38
|
+
const parameterName = name.startsWith("{") ? name : chunkOI2AOR2F_cjs.camelCase(name);
|
|
39
39
|
if (type) {
|
|
40
40
|
if (required) {
|
|
41
41
|
acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
@@ -99,7 +99,7 @@ async function timeout(ms) {
|
|
|
99
99
|
|
|
100
100
|
Object.defineProperty(exports, "URLPath", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkCZFLDKR5_cjs.URLPath; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "getUniqueName", {
|
|
105
105
|
enumerable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Generator core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"!/**/__tests__/**"
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"change-case": "^5.4.
|
|
70
|
+
"change-case": "^5.4.1",
|
|
71
71
|
"directory-tree": "^3.5.1",
|
|
72
72
|
"find-up": "^7.0.0",
|
|
73
73
|
"fs-extra": "^11.2.0",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"p-queue": "^8.0.1",
|
|
77
77
|
"seedrandom": "^3.0.5",
|
|
78
78
|
"semver": "^7.5.4",
|
|
79
|
-
"@kubb/parser": "2.2.
|
|
80
|
-
"@kubb/types": "2.2.
|
|
79
|
+
"@kubb/parser": "2.2.1",
|
|
80
|
+
"@kubb/types": "2.2.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/transformers/casing.ts","../../../node_modules/.pnpm/change-case@5.4.0/node_modules/change-case/src/index.ts"],"names":["camelCase","pascalCase"],"mappings":";;;;;AAAA;;;ACAA;AACA,IAAM,uBAAuB;AAC7B,IAAM,uBAAuB;AAG7B,IAAM,2BAA2B;AAGjC,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAG5B,IAAM,mCAAmC;AA+BnC,SAAU,MAAM,OAAa;AACjC,MAAI,SAAS,MAAM,KAAI;AAEvB,WAAS,OACN,QAAQ,sBAAsB,mBAAmB,EACjD,QAAQ,sBAAsB,mBAAmB;AAEpD,WAAS,OAAO,QAAQ,sBAAsB,IAAI;AAElD,MAAI,QAAQ;AACZ,MAAI,MAAM,OAAO;AAGjB,SAAO,OAAO,OAAO,KAAK,MAAM;AAAM;AACtC,MAAI,UAAU;AAAK,WAAO,CAAA;AAC1B,SAAO,OAAO,OAAO,MAAM,CAAC,MAAM;AAAM;AAExC,SAAO,OAAO,MAAM,OAAO,GAAG,EAAE,MAAM,KAAK;AAC7C;AAKM,SAAU,qBAAqB,OAAa;AAChD,QAAM,QAAQ,MAAM,KAAK;AACzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,QAAQ,yBAAyB,KAAK,IAAI;AAChD,QAAI,OAAO;AACT,YAAM,OAAO,GAAG,GAAG,KAAK,MAAM,GAAG,MAAM,KAAK,GAAG,KAAK,MAAM,MAAM,KAAK,CAAC;;;AAG1E,SAAO;AACT;AAiBM,SAAU,UAAU,OAAe,SAA2B;AAClE,QAAM,CAAC,QAAQ,OAAO,MAAM,IAAI,kBAAkB,OAAO,OAAO;AAChE,QAAM,QAAQ,aAAa,SAAS,MAAM;AAC1C,QAAM,QAAQ,aAAa,SAAS,MAAM;AAC1C,QAAM,YAAY,SAAS,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Q,UAAU,QAAQ,kBAAkB,uBAAuB;AACrE,QAAM,mBACJ,QAAQ,oBAAoB;AAC9B,QAAM,mBACJ,QAAQ,oBAAoB;AAC9B,MAAI,cAAc;AAClB,MAAI,cAAc,MAAM;AAExB,SAAO,cAAc,MAAM,QAAQ;AACjC,UAAM,OAAO,MAAM,OAAO,WAAW;AACrC,QAAI,CAAC,iBAAiB,SAAS,IAAI;AAAG;AACtC;;AAGF,SAAO,cAAc,aAAa;AAChC,UAAM,QAAQ,cAAc;AAC5B,UAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,QAAI,CAAC,iBAAiB,SAAS,IAAI;AAAG;AACtC,kBAAc;;AAGhB,SAAO;IACL,MAAM,MAAM,GAAG,WAAW;IAC1B,QAAQ,MAAM,MAAM,aAAa,WAAW,CAAC;IAC7C,MAAM,MAAM,WAAW;;AAE3B;;;ADrRO,SAASA,WAAU,MAAsB;AAC9C,SAAO,UAAgB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AAChF;AAEO,SAASC,YAAW,MAAsB;AAC/C,SAAO,WAAiB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AACjF","sourcesContent":["import { camelCase as changeCaseCamel, pascalCase as changePascalCase } from 'change-case'\n\nexport function camelCase(text: string): string {\n return changeCaseCamel(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n\nexport function pascalCase(text: string): string {\n return changePascalCase(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n","// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(?<=\\d)(\\p{Ll})|(?<=\\p{L})(\\d)/u;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options {\n locale?: Locale;\n split?: (value: string) => string[];\n /** @deprecated Pass `split: splitSeparateNumbers` instead. */\n separateNumbers?: boolean;\n delimiter?: string;\n prefixCharacters?: string;\n suffixCharacters?: string;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value: string) {\n let result = value.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value: string) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n words.splice(i, 1, word.slice(0, match.index), word.slice(match.index));\n }\n }\n return words;\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction splitPrefixSuffix(\n input: string,\n options: Options = {},\n): [string, string[], string] {\n const splitFn =\n options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters =\n options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters =\n options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters.includes(char)) break;\n prefixIndex++;\n }\n\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters.includes(char)) break;\n suffixIndex = index;\n }\n\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n"]}
|
|
File without changes
|