@kubb/core 3.5.0 → 3.5.2

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 (46) hide show
  1. package/dist/{FileManager-BEP6uN5W.d.cts → FileManager-BxDiClvd.d.cts} +2 -2
  2. package/dist/{FileManager-B-1XWq6Q.d.ts → FileManager-VhW4B9yd.d.ts} +2 -2
  3. package/dist/{chunk-S3IJRQEO.cjs → chunk-A5DJD2TT.cjs} +255 -39
  4. package/dist/chunk-A5DJD2TT.cjs.map +1 -0
  5. package/dist/{chunk-EECPIRGL.cjs → chunk-DSQCC7PM.cjs} +17 -17
  6. package/dist/{chunk-EECPIRGL.cjs.map → chunk-DSQCC7PM.cjs.map} +1 -1
  7. package/dist/{chunk-3CLNO5VR.js → chunk-E2WLQU27.js} +234 -26
  8. package/dist/chunk-E2WLQU27.js.map +1 -0
  9. package/dist/{chunk-LVELAYV4.cjs → chunk-LIRQEU5H.cjs} +4 -4
  10. package/dist/{chunk-LVELAYV4.cjs.map → chunk-LIRQEU5H.cjs.map} +1 -1
  11. package/dist/{chunk-MYLU2IFI.cjs → chunk-PLNJ73H7.cjs} +35 -35
  12. package/dist/{chunk-MYLU2IFI.cjs.map → chunk-PLNJ73H7.cjs.map} +1 -1
  13. package/dist/index.cjs +74 -58
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +5 -5
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +39 -23
  18. package/dist/index.js.map +1 -1
  19. package/dist/logger.cjs +6 -7
  20. package/dist/logger.js +1 -2
  21. package/dist/mocks.cjs +11 -11
  22. package/dist/mocks.cjs.map +1 -1
  23. package/dist/mocks.d.cts +1 -1
  24. package/dist/mocks.d.ts +1 -1
  25. package/dist/mocks.js +2 -2
  26. package/dist/mocks.js.map +1 -1
  27. package/dist/prompt-PTBVR4VS.cjs +762 -0
  28. package/dist/prompt-PTBVR4VS.cjs.map +1 -0
  29. package/dist/prompt-RQXXVSD5.js +751 -0
  30. package/dist/prompt-RQXXVSD5.js.map +1 -0
  31. package/dist/transformers.cjs +22 -22
  32. package/dist/utils.cjs +17 -17
  33. package/package.json +8 -8
  34. package/src/build.ts +41 -23
  35. package/src/config.ts +1 -1
  36. package/src/types.ts +1 -1
  37. package/dist/chunk-3CLNO5VR.js.map +0 -1
  38. package/dist/chunk-OL5US75J.js +0 -208
  39. package/dist/chunk-OL5US75J.js.map +0 -1
  40. package/dist/chunk-OQSYTQLS.cjs +0 -236
  41. package/dist/chunk-OQSYTQLS.cjs.map +0 -1
  42. package/dist/chunk-S3IJRQEO.cjs.map +0 -1
  43. package/dist/prompt-CV2GMUO3.cjs +0 -860
  44. package/dist/prompt-CV2GMUO3.cjs.map +0 -1
  45. package/dist/prompt-Y6ROOH2L.js +0 -848
  46. package/dist/prompt-Y6ROOH2L.js.map +0 -1
@@ -123,7 +123,7 @@ declare class PluginManager {
123
123
  * ...
124
124
  * })
125
125
  */
126
- type UserConfig = Omit<Config, 'root' | 'plugins'> & {
126
+ type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {
127
127
  /**
128
128
  * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.
129
129
  * @default process.cwd()
@@ -486,4 +486,4 @@ type WriteFilesProps = {
486
486
  };
487
487
  declare function processFiles({ dryRun, root, extension, logger, files }: WriteFilesProps): Promise<KubbFile.ResolvedFile[]>;
488
488
 
489
- export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n, type Group as o, processFiles as p };
489
+ export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, PluginManager as P, type ResolvePathParams as R, type UserConfig as U, type PluginFactoryOptions as a, type UserPluginWithLifeCycle as b, type FileMetaBase as c, type InputData as d, type PluginKey as e, type UserPlugin as f, getSource as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type ResolveNameParams as m, type PluginContext as n, type Group as o, processFiles as p };
@@ -123,7 +123,7 @@ declare class PluginManager {
123
123
  * ...
124
124
  * })
125
125
  */
126
- type UserConfig = Omit<Config, 'root' | 'plugins'> & {
126
+ type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {
127
127
  /**
128
128
  * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.
129
129
  * @default process.cwd()
@@ -486,4 +486,4 @@ type WriteFilesProps = {
486
486
  };
487
487
  declare function processFiles({ dryRun, root, extension, logger, files }: WriteFilesProps): Promise<KubbFile.ResolvedFile[]>;
488
488
 
489
- export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n, type Group as o, processFiles as p };
489
+ export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, PluginManager as P, type ResolvePathParams as R, type UserConfig as U, type PluginFactoryOptions as a, type UserPluginWithLifeCycle as b, type FileMetaBase as c, type InputData as d, type PluginKey as e, type UserPlugin as f, getSource as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type ResolveNameParams as m, type PluginContext as n, type Group as o, processFiles as p };
@@ -1,10 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkLVELAYV4_cjs = require('./chunk-LVELAYV4.cjs');
4
- var util = require('util');
5
- var path = require('path');
3
+ var chunkLIRQEU5H_cjs = require('./chunk-LIRQEU5H.cjs');
4
+ var seedrandom = require('seedrandom');
6
5
  var tty = require('tty');
7
- var process$1 = require('process');
6
+ var events = require('events');
7
+ var path = require('path');
8
+ var fs = require('@kubb/fs');
9
+ var util = require('util');
10
+ var p$1 = require('process');
8
11
 
9
12
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
13
 
@@ -26,11 +29,123 @@ function _interopNamespace(e) {
26
29
  return Object.freeze(n);
27
30
  }
28
31
 
32
+ var seedrandom__default = /*#__PURE__*/_interopDefault(seedrandom);
29
33
  var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
30
- var process$1__default = /*#__PURE__*/_interopDefault(process$1);
34
+ var p$1__default = /*#__PURE__*/_interopDefault(p$1);
35
+
36
+ // src/logger.ts
37
+ chunkLIRQEU5H_cjs.init_cjs_shims();
38
+
39
+ // ../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js
40
+ chunkLIRQEU5H_cjs.init_cjs_shims();
31
41
 
32
- // ../../node_modules/.pnpm/consola@3.3.3/node_modules/consola/dist/core.mjs
33
- chunkLVELAYV4_cjs.init_cjs_shims();
42
+ // ../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
43
+ chunkLIRQEU5H_cjs.init_cjs_shims();
44
+ var f = {
45
+ reset: [0, 0],
46
+ bold: [1, 22, "\x1B[22m\x1B[1m"],
47
+ dim: [2, 22, "\x1B[22m\x1B[2m"],
48
+ italic: [3, 23],
49
+ underline: [4, 24],
50
+ inverse: [7, 27],
51
+ hidden: [8, 28],
52
+ strikethrough: [9, 29],
53
+ black: [30, 39],
54
+ red: [31, 39],
55
+ green: [32, 39],
56
+ yellow: [33, 39],
57
+ blue: [34, 39],
58
+ magenta: [35, 39],
59
+ cyan: [36, 39],
60
+ white: [37, 39],
61
+ gray: [90, 39],
62
+ bgBlack: [40, 49],
63
+ bgRed: [41, 49],
64
+ bgGreen: [42, 49],
65
+ bgYellow: [43, 49],
66
+ bgBlue: [44, 49],
67
+ bgMagenta: [45, 49],
68
+ bgCyan: [46, 49],
69
+ bgWhite: [47, 49],
70
+ blackBright: [90, 39],
71
+ redBright: [91, 39],
72
+ greenBright: [92, 39],
73
+ yellowBright: [93, 39],
74
+ blueBright: [94, 39],
75
+ magentaBright: [95, 39],
76
+ cyanBright: [96, 39],
77
+ whiteBright: [97, 39],
78
+ bgBlackBright: [100, 49],
79
+ bgRedBright: [101, 49],
80
+ bgGreenBright: [102, 49],
81
+ bgYellowBright: [103, 49],
82
+ bgBlueBright: [104, 49],
83
+ bgMagentaBright: [105, 49],
84
+ bgCyanBright: [106, 49],
85
+ bgWhiteBright: [107, 49]
86
+ };
87
+ var h = Object.entries(f);
88
+ function a(n2) {
89
+ return String(n2);
90
+ }
91
+ a.open = "";
92
+ a.close = "";
93
+ function C(n2 = false) {
94
+ let e = typeof process != "undefined" ? process : void 0, i2 = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
95
+ return !("NO_COLOR" in i2 || g.includes("--no-color")) && ("FORCE_COLOR" in i2 || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n2 && i2.TERM !== "dumb" || "CI" in i2) || typeof window != "undefined" && !!window.chrome;
96
+ }
97
+ function p(n2 = false) {
98
+ let e = C(n2), i2 = (r3, t2, c2, o) => {
99
+ let l2 = "", s2 = 0;
100
+ do
101
+ l2 += r3.substring(s2, o) + c2, s2 = o + t2.length, o = r3.indexOf(t2, s2);
102
+ while (~o);
103
+ return l2 + r3.substring(s2);
104
+ }, g = (r3, t2, c2 = r3) => {
105
+ let o = (l2) => {
106
+ let s2 = String(l2), b = s2.indexOf(t2, r3.length);
107
+ return ~b ? r3 + i2(s2, t2, c2, b) + t2 : r3 + s2 + t2;
108
+ };
109
+ return o.open = r3, o.close = t2, o;
110
+ }, u2 = {
111
+ isColorSupported: e
112
+ }, d = (r3) => `\x1B[${r3}m`;
113
+ for (let [r3, t2] of h)
114
+ u2[r3] = e ? g(
115
+ d(t2[0]),
116
+ d(t2[1]),
117
+ t2[2]
118
+ ) : a;
119
+ return u2;
120
+ }
121
+ var p2 = p(tty.isatty(1));
122
+
123
+ // src/utils/EventEmitter.ts
124
+ chunkLIRQEU5H_cjs.init_cjs_shims();
125
+ var EventEmitter = class {
126
+ constructor() {
127
+ this.#emitter.setMaxListeners(100);
128
+ }
129
+ #emitter = new events.EventEmitter();
130
+ emit(eventName, ...eventArg) {
131
+ this.#emitter.emit(eventName, ...eventArg);
132
+ }
133
+ on(eventName, handler) {
134
+ this.#emitter.on(eventName, handler);
135
+ }
136
+ off(eventName, handler) {
137
+ this.#emitter.off(eventName, handler);
138
+ }
139
+ removeAll() {
140
+ this.#emitter.removeAllListeners();
141
+ }
142
+ };
143
+
144
+ // ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/index.mjs
145
+ chunkLIRQEU5H_cjs.init_cjs_shims();
146
+
147
+ // ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/core.mjs
148
+ chunkLIRQEU5H_cjs.init_cjs_shims();
34
149
  var LogLevels = {
35
150
  silent: Number.NEGATIVE_INFINITY,
36
151
  fatal: 0,
@@ -144,7 +259,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
144
259
  function createDefu(merger) {
145
260
  return (...arguments_) => (
146
261
  // eslint-disable-next-line unicorn/no-array-reduce
147
- arguments_.reduce((p2, c2) => _defu(p2, c2, ""), {})
262
+ arguments_.reduce((p4, c2) => _defu(p4, c2, ""), {})
148
263
  );
149
264
  }
150
265
  var defu = createDefu();
@@ -533,16 +648,16 @@ function createConsola(options = {}) {
533
648
  return new Consola(options);
534
649
  }
535
650
 
536
- // ../../node_modules/.pnpm/consola@3.3.3/node_modules/consola/dist/shared/consola.Cs5FdtHD.mjs
537
- chunkLVELAYV4_cjs.init_cjs_shims();
651
+ // ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/shared/consola.Cs5FdtHD.mjs
652
+ chunkLIRQEU5H_cjs.init_cjs_shims();
538
653
  function parseStack(stack) {
539
654
  const cwd = process.cwd() + path.sep;
540
655
  const lines = stack.split("\n").splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
541
656
  return lines;
542
657
  }
543
658
  function writeStream(data, stream) {
544
- const write = stream.__write || stream.write;
545
- return write.call(stream, data);
659
+ const write2 = stream.__write || stream.write;
660
+ return write2.call(stream, data);
546
661
  }
547
662
  var bracket = (x) => x ? `[${x}]` : "";
548
663
  var BasicReporter = class {
@@ -601,8 +716,8 @@ ${indent}`);
601
716
  }
602
717
  };
603
718
 
604
- // ../../node_modules/.pnpm/consola@3.3.3/node_modules/consola/dist/shared/consola.CBi6Nm9s.mjs
605
- chunkLVELAYV4_cjs.init_cjs_shims();
719
+ // ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/shared/consola.lX6kr4n8.mjs
720
+ chunkLIRQEU5H_cjs.init_cjs_shims();
606
721
  var {
607
722
  env = {},
608
723
  argv = [],
@@ -788,7 +903,7 @@ function box(text, _opts = {}) {
788
903
  }
789
904
  const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
790
905
  const height = textLines.length + paddingOffset;
791
- const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
906
+ const width = Math.max(...textLines.map((line) => stripAnsi(line).length)) + paddingOffset;
792
907
  const widthOffset = width + paddingOffset;
793
908
  const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
794
909
  if (opts.style.marginTop > 0) {
@@ -833,16 +948,13 @@ function box(text, _opts = {}) {
833
948
  }
834
949
  return boxLines.join("\n");
835
950
  }
836
-
837
- // ../../node_modules/.pnpm/consola@3.3.3/node_modules/consola/dist/shared/consola.DC9Xh_QO.mjs
838
- chunkLVELAYV4_cjs.init_cjs_shims();
839
- var r = /* @__PURE__ */ Object.create(null);
840
- var i = (e) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
841
- var s$1 = new Proxy(r, { get(e, o) {
842
- return i()[o] ?? r[o];
951
+ var r2 = /* @__PURE__ */ Object.create(null);
952
+ var i = (e) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r2 : globalThis);
953
+ var s$1 = new Proxy(r2, { get(e, o) {
954
+ return i()[o] ?? r2[o];
843
955
  }, has(e, o) {
844
956
  const E = i();
845
- return o in E || o in r;
957
+ return o in E || o in r2;
846
958
  }, set(e, o, E) {
847
959
  const b = i(true);
848
960
  return b[o] = E, true;
@@ -856,14 +968,14 @@ var s$1 = new Proxy(r, { get(e, o) {
856
968
  } });
857
969
  var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
858
970
  var B = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
859
- function p() {
971
+ function p3() {
860
972
  if (globalThis.process?.env) for (const e of B) {
861
973
  const o = e[1] || e[0];
862
974
  if (globalThis.process?.env[o]) return { name: e[0].toLowerCase(), ...e[2] };
863
975
  }
864
976
  return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
865
977
  }
866
- var l = p();
978
+ var l = p3();
867
979
  l.name;
868
980
  function n(e) {
869
981
  return e ? e !== "false" : false;
@@ -876,8 +988,8 @@ var A = t === "test" || n(s$1.TEST);
876
988
  n(s$1.MINIMAL) || T || A || !R;
877
989
  var _ = /^win/i.test(I);
878
990
  !n(s$1.NO_COLOR) && (n(s$1.FORCE_COLOR) || (R || _) && s$1.TERM !== "dumb" || T);
879
- var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
880
- Number(C?.split(".")[0]) || null;
991
+ var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
992
+ Number(C2?.split(".")[0]) || null;
881
993
  var y = globalThis.process || /* @__PURE__ */ Object.create(null);
882
994
  var c = { versions: {} };
883
995
  new Proxy(y, { get(e, o) {
@@ -886,13 +998,13 @@ new Proxy(y, { get(e, o) {
886
998
  if (o in c) return c[o];
887
999
  } });
888
1000
  var L = globalThis.process?.release?.name === "node";
889
- var a = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
1001
+ var a2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
890
1002
  var D = !!globalThis.Deno;
891
1003
  var O = !!globalThis.fastly;
892
1004
  var S = !!globalThis.Netlify;
893
1005
  var N = !!globalThis.EdgeRuntime;
894
1006
  var P = globalThis.navigator?.userAgent === "Cloudflare-Workers";
895
- var F = [[S, "netlify"], [N, "edge-light"], [P, "workerd"], [O, "fastly"], [D, "deno"], [a, "bun"], [L, "node"]];
1007
+ var F = [[S, "netlify"], [N, "edge-light"], [P, "workerd"], [O, "fastly"], [D, "deno"], [a2, "bun"], [L, "node"]];
896
1008
  function G() {
897
1009
  const e = F.find((o) => o[0]);
898
1010
  if (e) return { name: e[1] };
@@ -985,9 +1097,9 @@ function stringWidth$1(string, options = {}) {
985
1097
  return width;
986
1098
  }
987
1099
  function isUnicodeSupported() {
988
- const { env: env2 } = process$1__default.default;
1100
+ const { env: env2 } = p$1__default.default;
989
1101
  const { TERM, TERM_PROGRAM } = env2;
990
- if (process$1__default.default.platform !== "win32") {
1102
+ if (p$1__default.default.platform !== "win32") {
991
1103
  return TERM !== "linux";
992
1104
  }
993
1105
  return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
@@ -1030,7 +1142,7 @@ var FancyReporter = class extends BasicReporter {
1030
1142
  const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1031
1143
  return `
1032
1144
  ${indent}` + parseStack(stack).map(
1033
- (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
1145
+ (line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_2, m2) => `(${colors.cyan(m2)})`)
1034
1146
  ).join(`
1035
1147
  ${indent}`);
1036
1148
  }
@@ -1080,7 +1192,7 @@ ${indent}`);
1080
1192
  }
1081
1193
  };
1082
1194
  function characterFormat(str) {
1083
- return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
1195
+ return str.replace(/`([^`]+)`/gm, (_2, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_2, m2) => ` ${colors.underline(m2)} `);
1084
1196
  }
1085
1197
  function getColor2(color = "white") {
1086
1198
  return colors[color] || colors.white;
@@ -1098,7 +1210,7 @@ function createConsola2(options = {}) {
1098
1210
  defaults: { level },
1099
1211
  stdout: process.stdout,
1100
1212
  stderr: process.stderr,
1101
- prompt: (...args) => import('./prompt-CV2GMUO3.cjs').then((m) => m.prompt(...args)),
1213
+ prompt: (...args) => import('./prompt-PTBVR4VS.cjs').then((m2) => m2.prompt(...args)),
1102
1214
  reporters: options.reporters || [
1103
1215
  options.fancy ?? !(T || A) ? new FancyReporter() : new BasicReporter()
1104
1216
  ],
@@ -1117,8 +1229,112 @@ function _getDefaultLogLevel() {
1117
1229
  }
1118
1230
  createConsola2();
1119
1231
 
1120
- exports.colors = colors;
1121
- exports.createConsola = createConsola2;
1122
- exports.isUnicodeSupported = isUnicodeSupported;
1123
- //# sourceMappingURL=chunk-S3IJRQEO.cjs.map
1124
- //# sourceMappingURL=chunk-S3IJRQEO.cjs.map
1232
+ // src/logger.ts
1233
+ var LogMapper = {
1234
+ silent: Number.NEGATIVE_INFINITY,
1235
+ info: 3,
1236
+ debug: 4
1237
+ };
1238
+ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
1239
+ const events = new EventEmitter();
1240
+ const startDate = Date.now();
1241
+ const cachedLogs = /* @__PURE__ */ new Set();
1242
+ const consola2 = _consola || createConsola2({
1243
+ level: logLevel,
1244
+ formatOptions: {
1245
+ colors: true,
1246
+ date: true,
1247
+ columns: 80,
1248
+ compact: logLevel !== LogMapper.debug
1249
+ }
1250
+ }).withTag(name ? randomCliColour(name) : "");
1251
+ consola2?.wrapConsole();
1252
+ events.on("start", (message) => {
1253
+ consola2.start(message);
1254
+ });
1255
+ events.on("success", (message) => {
1256
+ consola2.success(message);
1257
+ });
1258
+ events.on("warning", (message) => {
1259
+ consola2.warn(p2.yellow(message));
1260
+ });
1261
+ events.on("info", (message) => {
1262
+ consola2.info(p2.yellow(message));
1263
+ });
1264
+ events.on("debug", (message) => {
1265
+ if (message.logs.join("\n\n").length <= 100 && logLevel === LogMapper.debug) {
1266
+ console.log(message.logs.join("\n\n"));
1267
+ }
1268
+ cachedLogs.add(message);
1269
+ });
1270
+ events.on("error", (message, cause) => {
1271
+ const error = new Error(message || "Something went wrong");
1272
+ error.cause = cause;
1273
+ throw error;
1274
+ });
1275
+ if (consola2) {
1276
+ consola2.level = logLevel;
1277
+ }
1278
+ const logger = {
1279
+ name,
1280
+ logLevel,
1281
+ consola: consola2,
1282
+ on(...args) {
1283
+ return events.on(...args);
1284
+ },
1285
+ emit(...args) {
1286
+ return events.emit(...args);
1287
+ },
1288
+ async writeLogs() {
1289
+ const files = {};
1290
+ cachedLogs.forEach((log) => {
1291
+ const fileName = path.resolve(process.cwd(), ".kubb", log.fileName || `kubb-${startDate}.log`);
1292
+ if (!files[fileName]) {
1293
+ files[fileName] = [];
1294
+ }
1295
+ files[fileName] = [...files[fileName], `[${log.date.toLocaleString()}]: ${log.logs.join("\n\n")}`];
1296
+ });
1297
+ await Promise.all(
1298
+ Object.entries(files).map(async ([fileName, logs]) => {
1299
+ return fs.write(fileName, logs.join("\n"));
1300
+ })
1301
+ );
1302
+ return Object.keys(files);
1303
+ }
1304
+ };
1305
+ return logger;
1306
+ }
1307
+ var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
1308
+ function randomColour(text, colours = defaultColours) {
1309
+ if (!text) {
1310
+ return "white";
1311
+ }
1312
+ const random = seedrandom__default.default(text);
1313
+ const colour = colours.at(Math.floor(random() * colours.length)) || "white";
1314
+ return colour;
1315
+ }
1316
+ function randomCliColour(text, colors2 = defaultColours) {
1317
+ const colours = p(true);
1318
+ if (!text) {
1319
+ return colours.white(text);
1320
+ }
1321
+ const colour = randomColour(text, colors2);
1322
+ const isDark = colour.includes("dark");
1323
+ const key = colour.replace("dark", "").toLowerCase();
1324
+ const formatter = colours[key];
1325
+ if (isDark) {
1326
+ return p2.bold(formatter(text));
1327
+ }
1328
+ if (typeof formatter !== "function") {
1329
+ throw new Error("Formatter for picoColor is not of type function/Formatter");
1330
+ }
1331
+ return formatter(text);
1332
+ }
1333
+
1334
+ exports.EventEmitter = EventEmitter;
1335
+ exports.LogMapper = LogMapper;
1336
+ exports.createLogger = createLogger;
1337
+ exports.randomCliColour = randomCliColour;
1338
+ exports.randomColour = randomColour;
1339
+ //# sourceMappingURL=chunk-A5DJD2TT.cjs.map
1340
+ //# sourceMappingURL=chunk-A5DJD2TT.cjs.map