@kubb/core 2.0.0-beta.11 → 2.0.0-beta.12

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.d.cts CHANGED
@@ -4,7 +4,6 @@ import { DirectoryTreeOptions } from 'directory-tree';
4
4
  import { E as EventEmitter, Q as Queue, a as QueueJob } from './Queue-2-6pMcCx.cjs';
5
5
  import { Logger, LogLevel } from './logger.cjs';
6
6
  import 'ora';
7
- import 'picocolors';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ import { DirectoryTreeOptions } from 'directory-tree';
4
4
  import { E as EventEmitter, Q as Queue, a as QueueJob } from './Queue-2-6pMcCx.js';
5
5
  import { Logger, LogLevel } from './logger.js';
6
6
  import 'ora';
7
- import 'picocolors';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import mod, { createRequire } from 'module';
2
- import pc2 from 'picocolors';
2
+ import { isatty } from 'tty';
3
3
  import path4, { resolve, dirname, extname, relative, basename } from 'path';
4
4
  import { switcher } from 'js-runtime';
5
- import { camelCase as camelCase$1, camelCaseTransformMerge, pascalCase as pascalCase$1, pascalCaseTransformMerge } from 'change-case';
6
5
  import crypto2 from 'crypto';
7
6
  import { print } from '@kubb/parser';
8
7
  import * as factory from '@kubb/parser/factory';
@@ -26,12 +25,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
26
25
  var __getProtoOf = Object.getPrototypeOf;
27
26
  var __hasOwnProp = Object.prototype.hasOwnProperty;
28
27
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
30
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
31
- }) : x)(function(x) {
28
+ var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
29
+ get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
30
+ }) : x2)(function(x2) {
32
31
  if (typeof require !== "undefined")
33
32
  return require.apply(this, arguments);
34
- throw Error('Dynamic require of "' + x + '" is not supported');
33
+ throw Error('Dynamic require of "' + x2 + '" is not supported');
35
34
  });
36
35
  var __esm = (fn, res) => function __init() {
37
36
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -119,7 +118,7 @@ var require_universalify = __commonJS({
119
118
  return fn.apply(this, args);
120
119
  else {
121
120
  args.pop();
122
- fn.apply(this, args).then((r) => cb(null, r), cb);
121
+ fn.apply(this, args).then((r2) => cb(null, r2), cb);
123
122
  }
124
123
  }, "name", { value: fn.name });
125
124
  };
@@ -145,9 +144,9 @@ var require_polyfills = __commonJS({
145
144
  }
146
145
  if (typeof process.chdir === "function") {
147
146
  chdir = process.chdir;
148
- process.chdir = function(d) {
147
+ process.chdir = function(d2) {
149
148
  cwd = null;
150
- chdir.call(process, d);
149
+ chdir.call(process, d2);
151
150
  };
152
151
  if (Object.setPrototypeOf)
153
152
  Object.setPrototypeOf(process.chdir, chdir);
@@ -3008,6 +3007,71 @@ init_esm_shims();
3008
3007
  // src/build.ts
3009
3008
  init_esm_shims();
3010
3009
 
3010
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
3011
+ init_esm_shims();
3012
+
3013
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
3014
+ init_esm_shims();
3015
+ var b = {
3016
+ reset: [0, 0],
3017
+ bold: [1, 22, "\x1B[22m\x1B[1m"],
3018
+ dim: [2, 22, "\x1B[22m\x1B[2m"],
3019
+ italic: [3, 23],
3020
+ underline: [4, 24],
3021
+ inverse: [7, 27],
3022
+ hidden: [8, 28],
3023
+ strikethrough: [9, 29],
3024
+ black: [30, 39],
3025
+ red: [31, 39],
3026
+ green: [32, 39],
3027
+ yellow: [33, 39],
3028
+ blue: [34, 39],
3029
+ magenta: [35, 39],
3030
+ cyan: [36, 39],
3031
+ white: [37, 39],
3032
+ gray: [90, 39],
3033
+ bgBlack: [40, 49],
3034
+ bgRed: [41, 49],
3035
+ bgGreen: [42, 49],
3036
+ bgYellow: [43, 49],
3037
+ bgBlue: [44, 49],
3038
+ bgMagenta: [45, 49],
3039
+ bgCyan: [46, 49],
3040
+ bgWhite: [47, 49]
3041
+ };
3042
+ var C = Object.entries(b);
3043
+ function d(r2) {
3044
+ return String(r2);
3045
+ }
3046
+ d.open = "";
3047
+ d.close = "";
3048
+ function p(r2 = false) {
3049
+ let n = typeof process != "undefined" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];
3050
+ return !("NO_COLOR" in t || a.includes("--no-color")) && !("GITHUB_ACTIONS" in t) && ("FORCE_COLOR" in t || a.includes("--color") || (n == null ? void 0 : n.platform) === "win32" || r2 && t.TERM !== "dumb" || "CI" in t) || typeof window != "undefined" && !!window.chrome;
3051
+ }
3052
+ function w(r2 = false) {
3053
+ let n = p(r2), t = (e, o, c, i) => {
3054
+ let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);
3055
+ return ~l ? u + t(s, o, c, l) : u + s;
3056
+ }, a = (e, o, c = e) => {
3057
+ let i = (u) => {
3058
+ let s = String(u), l = s.indexOf(o, e.length);
3059
+ return ~l ? e + t(s, o, c, l) + o : e + s + o;
3060
+ };
3061
+ return i.open = e, i.close = o, i;
3062
+ }, g = {
3063
+ isColorSupported: n
3064
+ }, f = (e) => `\x1B[${e}m`;
3065
+ for (let [e, o] of C)
3066
+ g[e] = n ? a(
3067
+ f(o[0]),
3068
+ f(o[1]),
3069
+ o[2]
3070
+ ) : d;
3071
+ return g;
3072
+ }
3073
+ var p2 = w(isatty(1));
3074
+
3011
3075
  // src/fs/clean.ts
3012
3076
  init_esm_shims();
3013
3077
  var import_fs_extra = __toESM(require_lib(), 1);
@@ -3071,11 +3135,86 @@ init_esm_shims();
3071
3135
 
3072
3136
  // src/transformers/casing.ts
3073
3137
  init_esm_shims();
3074
- function camelCase(text) {
3075
- return camelCase$1(text, { delimiter: "", stripRegexp: /[^A-Z0-9$]/gi, transform: camelCaseTransformMerge });
3138
+
3139
+ // ../../node_modules/.pnpm/change-case@5.2.0/node_modules/change-case/dist/index.js
3140
+ init_esm_shims();
3141
+ var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
3142
+ var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
3143
+ var SPLIT_NUMBER_LOWER_RE = /(\d)(\p{Ll})/gu;
3144
+ var SPLIT_LETTER_NUMBER_RE = /(\p{L})(\d)/gu;
3145
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
3146
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
3147
+ var DEFAULT_PREFIX_CHARACTERS = "";
3148
+ function split(input, options) {
3149
+ let result = input.trim();
3150
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
3151
+ if (options?.separateNumbers) {
3152
+ result = result.replace(SPLIT_NUMBER_LOWER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_LETTER_NUMBER_RE, SPLIT_REPLACE_VALUE);
3153
+ }
3154
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
3155
+ let start = 0;
3156
+ let end = result.length;
3157
+ while (result.charAt(start) === "\0")
3158
+ start++;
3159
+ if (start === end)
3160
+ return [];
3161
+ while (result.charAt(end - 1) === "\0")
3162
+ end--;
3163
+ return result.slice(start, end).split(/\0/g);
3164
+ }
3165
+ function camelCase(input, options) {
3166
+ const prefix = getPrefix(input, options?.prefixCharacters);
3167
+ const lower = lowerFactory(options?.locale);
3168
+ const upper = upperFactory(options?.locale);
3169
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3170
+ return prefix + split(input, options).map((word, index) => {
3171
+ if (index === 0)
3172
+ return lower(word);
3173
+ return transform(word, index);
3174
+ }).join(options?.delimiter ?? "");
3175
+ }
3176
+ function pascalCase(input, options) {
3177
+ const prefix = getPrefix(input, options?.prefixCharacters);
3178
+ const lower = lowerFactory(options?.locale);
3179
+ const upper = upperFactory(options?.locale);
3180
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3181
+ return prefix + split(input, options).map(transform).join(options?.delimiter ?? "");
3182
+ }
3183
+ function lowerFactory(locale) {
3184
+ return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
3185
+ }
3186
+ function upperFactory(locale) {
3187
+ return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
3076
3188
  }
3077
- function pascalCase(text) {
3078
- return pascalCase$1(text, { delimiter: "", stripRegexp: /[^A-Z0-9$]/gi, transform: pascalCaseTransformMerge });
3189
+ function capitalCaseTransformFactory(lower, upper) {
3190
+ return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
3191
+ }
3192
+ function pascalCaseTransformFactory(lower, upper) {
3193
+ return (word, index) => {
3194
+ const char0 = word[0];
3195
+ const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
3196
+ return initial + lower(word.slice(1));
3197
+ };
3198
+ }
3199
+ function getPrefix(input, prefixCharacters = DEFAULT_PREFIX_CHARACTERS) {
3200
+ let prefix = "";
3201
+ for (let i = 0; i < input.length; i++) {
3202
+ const char = input.charAt(i);
3203
+ if (prefixCharacters.includes(char)) {
3204
+ prefix += char;
3205
+ } else {
3206
+ break;
3207
+ }
3208
+ }
3209
+ return prefix;
3210
+ }
3211
+
3212
+ // src/transformers/casing.ts
3213
+ function camelCase2(text) {
3214
+ return camelCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
3215
+ }
3216
+ function pascalCase2(text) {
3217
+ return pascalCase(text, { delimiter: "", mergeAmbiguousCharacters: true });
3079
3218
  }
3080
3219
 
3081
3220
  // src/transformers/combineCodes.ts
@@ -3130,11 +3269,11 @@ function createIndent(size) {
3130
3269
 
3131
3270
  // src/transformers/nameSorter.ts
3132
3271
  init_esm_shims();
3133
- function nameSorter(a, b) {
3134
- if (a.name < b.name) {
3272
+ function nameSorter(a, b2) {
3273
+ if (a.name < b2.name) {
3135
3274
  return -1;
3136
3275
  }
3137
- if (a.name > b.name) {
3276
+ if (a.name > b2.name) {
3138
3277
  return 1;
3139
3278
  }
3140
3279
  return 0;
@@ -3275,8 +3414,8 @@ var transformers_default = {
3275
3414
  JSDoc: {
3276
3415
  createJSDocBlockText
3277
3416
  },
3278
- camelCase,
3279
- pascalCase
3417
+ camelCase: camelCase2,
3418
+ pascalCase: pascalCase2
3280
3419
  };
3281
3420
 
3282
3421
  // src/utils/URLPath.ts
@@ -3941,7 +4080,7 @@ function createLogger({ logLevel, name, spinner }) {
3941
4080
  };
3942
4081
  const warn = (message) => {
3943
4082
  if (message && spinner) {
3944
- spinner.warn(pc2.yellow(message));
4083
+ spinner.warn(p2.yellow(message));
3945
4084
  logs.push(message);
3946
4085
  }
3947
4086
  };
@@ -3972,8 +4111,8 @@ function randomColour(text, colours = defaultColours) {
3972
4111
  const colour = colours.at(Math.floor(random() * colours.length)) || "white";
3973
4112
  return colour;
3974
4113
  }
3975
- function randomPicoColour(text, colors = defaultColours) {
3976
- const colours = pc2.createColors(true);
4114
+ function randomCliColour(text, colors = defaultColours) {
4115
+ const colours = w(true);
3977
4116
  if (!text) {
3978
4117
  return colours.white(text);
3979
4118
  }
@@ -3982,7 +4121,7 @@ function randomPicoColour(text, colors = defaultColours) {
3982
4121
  const key = colour.replace("dark", "").toLowerCase();
3983
4122
  const formatter = colours[key];
3984
4123
  if (isDark) {
3985
- return pc2.bold(formatter(text));
4124
+ return p2.bold(formatter(text));
3986
4125
  }
3987
4126
  if (typeof formatter !== "function") {
3988
4127
  throw new Error("Formatter for picoColor is not of type function/Formatter");
@@ -4582,11 +4721,11 @@ getSortedPlugins_fn = function(hookName) {
4582
4721
  }
4583
4722
  }
4584
4723
  return plugin;
4585
- }).sort((a, b) => {
4586
- if (b.pre?.includes(a.name)) {
4724
+ }).sort((a, b2) => {
4725
+ if (b2.pre?.includes(a.name)) {
4587
4726
  return 1;
4588
4727
  }
4589
- if (b.post?.includes(a.name)) {
4728
+ if (b2.post?.includes(a.name)) {
4590
4729
  return -1;
4591
4730
  }
4592
4731
  return 0;
@@ -4717,7 +4856,7 @@ async function setup(options) {
4717
4856
  } catch (e) {
4718
4857
  if (isInputPath(config)) {
4719
4858
  throw new Error(
4720
- "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + pc2.dim(config.input.path),
4859
+ "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + p2.dim(config.input.path),
4721
4860
  {
4722
4861
  cause: e
4723
4862
  }
@@ -4770,7 +4909,7 @@ async function setup(options) {
4770
4909
  logger.spinner.start(`\u{1F4BE} Writing`);
4771
4910
  }
4772
4911
  if (logger.logLevel === LogLevel.debug) {
4773
- logger.info(`PluginKey ${pc2.dim(JSON.stringify(plugin.key))}
4912
+ logger.info(`PluginKey ${p2.dim(JSON.stringify(plugin.key))}
4774
4913
  with source
4775
4914
 
4776
4915
  ${code}`);
@@ -4779,11 +4918,11 @@ ${code}`);
4779
4918
  });
4780
4919
  pluginManager.on("executed", (executer) => {
4781
4920
  const { hookName, plugin, output, parameters } = executer;
4782
- const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`;
4921
+ const messsage = `${randomCliColour(plugin.name)} Executing ${hookName}`;
4783
4922
  if (logger.logLevel === LogLevel.info && logger.spinner) {
4784
4923
  if (hookName === "writeFile") {
4785
4924
  const [_code, path5] = parameters;
4786
- logger.spinner.suffixText = pc2.dim(path5);
4925
+ logger.spinner.suffixText = p2.dim(path5);
4787
4926
  } else {
4788
4927
  logger.spinner.suffixText = messsage;
4789
4928
  }
@@ -4791,9 +4930,9 @@ ${code}`);
4791
4930
  if (logger.logLevel === LogLevel.debug) {
4792
4931
  logger.info(messsage);
4793
4932
  const logs = [
4794
- parameters && `${pc2.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,
4933
+ parameters && `${p2.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,
4795
4934
  JSON.stringify(parameters, void 0, 2),
4796
- output && `${pc2.bgWhite("Output")} ${randomPicoColour(plugin.name)} ${hookName}`,
4935
+ output && `${p2.bgWhite("Output")} ${randomCliColour(plugin.name)} ${hookName}`,
4797
4936
  output
4798
4937
  ].filter(Boolean);
4799
4938
  console.log(logs.join("\n"));
@@ -4865,7 +5004,7 @@ _context = new WeakMap();
4865
5004
  // src/PackageManager.ts
4866
5005
  init_esm_shims();
4867
5006
 
4868
- // ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
5007
+ // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
4869
5008
  init_esm_shims();
4870
5009
 
4871
5010
  // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
@@ -5073,17 +5212,22 @@ function locatePathSync(paths, {
5073
5212
  }
5074
5213
  }
5075
5214
 
5215
+ // ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
5216
+ init_esm_shims();
5217
+ function toPath2(urlOrPath) {
5218
+ return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
5219
+ }
5220
+
5076
5221
  // ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
5077
5222
  init_esm_shims();
5078
5223
 
5079
- // ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
5080
- var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
5224
+ // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
5081
5225
  var findUpStop = Symbol("findUpStop");
5082
5226
  async function findUpMultiple(name, options = {}) {
5083
- let directory = path4.resolve(toPath2(options.cwd) || "");
5227
+ let directory = path4.resolve(toPath2(options.cwd) ?? "");
5084
5228
  const { root } = path4.parse(directory);
5085
- const stopAt = path4.resolve(directory, options.stopAt || root);
5086
- const limit = options.limit || Number.POSITIVE_INFINITY;
5229
+ const stopAt = path4.resolve(directory, toPath2(options.stopAt ?? root));
5230
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
5087
5231
  const paths = [name].flat();
5088
5232
  const runMatcher = async (locateOptions) => {
5089
5233
  if (typeof name !== "function") {
@@ -5112,10 +5256,10 @@ async function findUpMultiple(name, options = {}) {
5112
5256
  return matches;
5113
5257
  }
5114
5258
  function findUpMultipleSync(name, options = {}) {
5115
- let directory = path4.resolve(toPath2(options.cwd) || "");
5259
+ let directory = path4.resolve(toPath2(options.cwd) ?? "");
5116
5260
  const { root } = path4.parse(directory);
5117
- const stopAt = options.stopAt || root;
5118
- const limit = options.limit || Number.POSITIVE_INFINITY;
5261
+ const stopAt = path4.resolve(directory, toPath2(options.stopAt) ?? root);
5262
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
5119
5263
  const paths = [name].flat();
5120
5264
  const runMatcher = (locateOptions) => {
5121
5265
  if (typeof name !== "function") {