@kubb/core 2.6.6 → 2.7.0

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.
Files changed (77) hide show
  1. package/dist/{chunk-NGM34FB2.cjs → chunk-2JNTDAI2.cjs} +17 -17
  2. package/dist/{chunk-NGM34FB2.cjs.map → chunk-2JNTDAI2.cjs.map} +1 -1
  3. package/dist/{chunk-IAM2TSOD.js → chunk-3HKED6KQ.js} +59 -23
  4. package/dist/chunk-3HKED6KQ.js.map +1 -0
  5. package/dist/{chunk-DZ63TRO3.js → chunk-6453B5D6.js} +13 -5
  6. package/dist/chunk-6453B5D6.js.map +1 -0
  7. package/dist/{chunk-DDBPI6U7.js → chunk-7LKI2367.js} +12 -7
  8. package/dist/chunk-7LKI2367.js.map +1 -0
  9. package/dist/{chunk-FEAY5FTX.cjs → chunk-AMVMOCJ4.cjs} +23 -22
  10. package/dist/{chunk-O6KGDMGN.cjs → chunk-BCD4E3IZ.cjs} +303 -298
  11. package/dist/chunk-BCD4E3IZ.cjs.map +1 -0
  12. package/dist/{chunk-QUL3TACU.js → chunk-DUZFWQUE.js} +13 -8
  13. package/dist/chunk-DUZFWQUE.js.map +1 -0
  14. package/dist/{chunk-RVIZ52LV.js → chunk-E4QOZYOP.js} +24 -10
  15. package/dist/chunk-E4QOZYOP.js.map +1 -0
  16. package/dist/chunk-EFAVSUDO.cjs +19 -0
  17. package/dist/{chunk-XMJY6AMI.js → chunk-HTCJOTLL.js} +11 -7
  18. package/dist/chunk-HTCJOTLL.js.map +1 -0
  19. package/dist/{chunk-DNFR6EDG.cjs → chunk-JWYPCGK5.cjs} +14 -13
  20. package/dist/{chunk-DZZXW555.cjs → chunk-KRX65PCH.cjs} +32 -29
  21. package/dist/{chunk-B3FP7HMI.cjs → chunk-M5H5RXTY.cjs} +12 -9
  22. package/dist/{chunk-JQBPOWRF.cjs → chunk-PHI4BK5K.cjs} +162 -124
  23. package/dist/{chunk-7QEHTZ4T.js → chunk-QDUQWRFO.js} +8 -4
  24. package/dist/chunk-QDUQWRFO.js.map +1 -0
  25. package/dist/{chunk-MCUCYURB.js → chunk-VCS7BATE.js} +10 -5
  26. package/dist/chunk-VCS7BATE.js.map +1 -0
  27. package/dist/{chunk-CPVVYFYJ.cjs → chunk-WCUXF325.cjs} +8 -7
  28. package/dist/{chunk-P5VTO36N.cjs → chunk-WDKUUZXN.cjs} +21 -17
  29. package/dist/chunk-YFNYSIDY.js +15 -0
  30. package/dist/chunk-YFNYSIDY.js.map +1 -0
  31. package/dist/{chunk-5TWA5OHW.js → chunk-YNFGR7GL.js} +10 -4
  32. package/dist/chunk-YNFGR7GL.js.map +1 -0
  33. package/dist/fs.cjs +21 -28
  34. package/dist/fs.js +21 -5
  35. package/dist/fs.js.map +1 -1
  36. package/dist/index.cjs +189 -189
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +8 -2
  39. package/dist/index.d.ts +8 -2
  40. package/dist/index.js +61 -19
  41. package/dist/index.js.map +1 -1
  42. package/dist/logger.cjs +14 -25
  43. package/dist/logger.js +14 -4
  44. package/dist/logger.js.map +1 -1
  45. package/dist/mocks.cjs +14 -12
  46. package/dist/mocks.js +15 -11
  47. package/dist/mocks.js.map +1 -1
  48. package/dist/transformers.cjs +40 -54
  49. package/dist/transformers.js +30 -8
  50. package/dist/transformers.js.map +1 -1
  51. package/dist/utils.cjs +34 -36
  52. package/dist/utils.js +25 -8
  53. package/dist/utils.js.map +1 -1
  54. package/package.json +4 -4
  55. package/src/FileManager.ts +14 -4
  56. package/src/index.ts +1 -1
  57. package/dist/chunk-33K7PH2K.cjs +0 -15
  58. package/dist/chunk-CPVVYFYJ.cjs.map +0 -1
  59. package/dist/chunk-DDBPI6U7.js.map +0 -1
  60. package/dist/chunk-DNFR6EDG.cjs.map +0 -1
  61. package/dist/chunk-DZ63TRO3.js.map +0 -1
  62. package/dist/chunk-IAM2TSOD.js.map +0 -1
  63. package/dist/chunk-MCUCYURB.js.map +0 -1
  64. package/dist/chunk-O6KGDMGN.cjs.map +0 -1
  65. package/dist/chunk-QUL3TACU.js.map +0 -1
  66. package/dist/chunk-RVIZ52LV.js.map +0 -1
  67. package/dist/chunk-XMJY6AMI.js.map +0 -1
  68. package/dist/chunk-YETB7TYW.js +0 -12
  69. package/dist/chunk-YETB7TYW.js.map +0 -1
  70. /package/dist/{chunk-FEAY5FTX.cjs.map → chunk-AMVMOCJ4.cjs.map} +0 -0
  71. /package/dist/{chunk-33K7PH2K.cjs.map → chunk-EFAVSUDO.cjs.map} +0 -0
  72. /package/dist/{chunk-5TWA5OHW.js.map → chunk-JWYPCGK5.cjs.map} +0 -0
  73. /package/dist/{chunk-DZZXW555.cjs.map → chunk-KRX65PCH.cjs.map} +0 -0
  74. /package/dist/{chunk-B3FP7HMI.cjs.map → chunk-M5H5RXTY.cjs.map} +0 -0
  75. /package/dist/{chunk-JQBPOWRF.cjs.map → chunk-PHI4BK5K.cjs.map} +0 -0
  76. /package/dist/{chunk-7QEHTZ4T.js.map → chunk-WCUXF325.cjs.map} +0 -0
  77. /package/dist/{chunk-P5VTO36N.cjs.map → chunk-WDKUUZXN.cjs.map} +0 -0
@@ -1,10 +1,12 @@
1
- import { init_esm_shims } from './chunk-DZ63TRO3.js';
2
- import { relative, basename, extname } from 'path';
3
- import fs from 'fs-extra';
4
- import { switcher } from 'js-runtime';
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-6453B5D6.js";
5
4
 
6
5
  // src/fs/read.ts
7
6
  init_esm_shims();
7
+ import { basename, extname, relative } from "path";
8
+ import fs from "fs-extra";
9
+ import { switcher } from "js-runtime";
8
10
  function slash(path, platform = "linux") {
9
11
  const isWindowsPath = /^\\\\\?\\/.test(path);
10
12
  if (["linux", "mac"].includes(platform) && !isWindowsPath) {
@@ -53,6 +55,9 @@ function readSync(path) {
53
55
  return syncReader(path);
54
56
  }
55
57
 
56
- export { getRelativePath, read, readSync };
57
- //# sourceMappingURL=out.js.map
58
- //# sourceMappingURL=chunk-DDBPI6U7.js.map
58
+ export {
59
+ getRelativePath,
60
+ read,
61
+ readSync
62
+ };
63
+ //# sourceMappingURL=chunk-7LKI2367.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fs/read.ts"],"sourcesContent":["import { basename, extname, relative } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n }\n\n // windows\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))\n }\n\n return `./${slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))}`\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n"],"mappings":";;;;;AAAA;AAAA,SAAS,UAAU,SAAS,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ACA,KAAK,MAAM;AACT,YAAM,IAAI,MAAM,sBAAsB;AAAA,IACxC;AAAA,EACF;AAAA,EACA;AACF;AAEA,eAAsB,KAAK,MAA+B;AACxD,SAAO,OAAO,IAAI;AACpB;AAEO,SAAS,SAAS,MAAsB;AAC7C,SAAO,WAAW,IAAI;AACxB;","names":[]}
@@ -1,12 +1,12 @@
1
- 'use strict';
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var chunkNGM34FB2_cjs = require('./chunk-NGM34FB2.cjs');
3
+ var _chunk2JNTDAI2cjs = require('./chunk-2JNTDAI2.cjs');
4
4
 
5
5
  // src/transformers/casing.ts
6
- chunkNGM34FB2_cjs.init_cjs_shims();
6
+ _chunk2JNTDAI2cjs.init_cjs_shims.call(void 0, );
7
7
 
8
8
  // ../../node_modules/.pnpm/change-case@5.4.3/node_modules/change-case/dist/index.js
9
- chunkNGM34FB2_cjs.init_cjs_shims();
9
+ _chunk2JNTDAI2cjs.init_cjs_shims.call(void 0, );
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
12
  var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
@@ -33,7 +33,7 @@ function splitSeparateNumbers(value) {
33
33
  const word = words[i];
34
34
  const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
35
35
  if (match) {
36
- const offset = match.index + (match[1] ?? match[2]).length;
36
+ const offset = match.index + (_nullishCoalesce(match[1], () => ( match[2]))).length;
37
37
  words.splice(i, 1, word.slice(0, offset), word.slice(offset));
38
38
  }
39
39
  }
@@ -41,25 +41,25 @@ function splitSeparateNumbers(value) {
41
41
  }
42
42
  function noCase(input, options) {
43
43
  const [prefix, words, suffix] = splitPrefixSuffix(input, options);
44
- return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
44
+ return prefix + words.map(lowerFactory(_optionalChain([options, 'optionalAccess', _ => _.locale]))).join(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.delimiter]), () => ( " "))) + suffix;
45
45
  }
46
46
  function camelCase(input, options) {
47
47
  const [prefix, words, suffix] = splitPrefixSuffix(input, options);
48
- const lower = lowerFactory(options?.locale);
49
- const upper = upperFactory(options?.locale);
50
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
48
+ const lower = lowerFactory(_optionalChain([options, 'optionalAccess', _3 => _3.locale]));
49
+ const upper = upperFactory(_optionalChain([options, 'optionalAccess', _4 => _4.locale]));
50
+ const transform = _optionalChain([options, 'optionalAccess', _5 => _5.mergeAmbiguousCharacters]) ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
51
51
  return prefix + words.map((word, index) => {
52
52
  if (index === 0)
53
53
  return lower(word);
54
54
  return transform(word, index);
55
- }).join(options?.delimiter ?? "") + suffix;
55
+ }).join(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _6 => _6.delimiter]), () => ( ""))) + suffix;
56
56
  }
57
57
  function pascalCase(input, options) {
58
58
  const [prefix, words, suffix] = splitPrefixSuffix(input, options);
59
- const lower = lowerFactory(options?.locale);
60
- const upper = upperFactory(options?.locale);
61
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
62
- return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
59
+ const lower = lowerFactory(_optionalChain([options, 'optionalAccess', _7 => _7.locale]));
60
+ const upper = upperFactory(_optionalChain([options, 'optionalAccess', _8 => _8.locale]));
61
+ const transform = _optionalChain([options, 'optionalAccess', _9 => _9.mergeAmbiguousCharacters]) ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
62
+ return prefix + words.map(transform).join(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _10 => _10.delimiter]), () => ( ""))) + suffix;
63
63
  }
64
64
  function pathCase(input, options) {
65
65
  return noCase(input, { delimiter: "/", ...options });
@@ -81,9 +81,9 @@ function pascalCaseTransformFactory(lower, upper) {
81
81
  };
82
82
  }
83
83
  function splitPrefixSuffix(input, options = {}) {
84
- const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
85
- const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
86
- const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
84
+ const splitFn = _nullishCoalesce(options.split, () => ( (options.separateNumbers ? splitSeparateNumbers : split)));
85
+ const prefixCharacters = _nullishCoalesce(options.prefixCharacters, () => ( DEFAULT_PREFIX_SUFFIX_CHARACTERS));
86
+ const suffixCharacters = _nullishCoalesce(options.suffixCharacters, () => ( DEFAULT_PREFIX_SUFFIX_CHARACTERS));
87
87
  let prefixIndex = 0;
88
88
  let suffixIndex = input.length;
89
89
  while (prefixIndex < input.length) {
@@ -129,8 +129,9 @@ function pathCase2(text, { isFile, prefix = "", suffix = "" } = {}) {
129
129
  return pathCase(`${prefix} ${text} ${suffix}`, { delimiter: "" });
130
130
  }
131
131
 
132
- exports.camelCase = camelCase2;
133
- exports.pascalCase = pascalCase2;
134
- exports.pathCase = pathCase2;
135
- //# sourceMappingURL=out.js.map
136
- //# sourceMappingURL=chunk-FEAY5FTX.cjs.map
132
+
133
+
134
+
135
+
136
+ exports.camelCase = camelCase2; exports.pascalCase = pascalCase2; exports.pathCase = pathCase2;
137
+ //# sourceMappingURL=chunk-AMVMOCJ4.cjs.map