@kubb/core 3.7.1 → 3.7.3

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 (39) hide show
  1. package/dist/{FileManager-ReyBN79g.d.ts → FileManager-BSJoY0XN.d.ts} +1 -1
  2. package/dist/{FileManager-DcUC8taH.d.cts → FileManager-Cg92aWHj.d.cts} +1 -1
  3. package/dist/{chunk-CK6IAYQK.js → chunk-4ESUQQVB.js} +257 -350
  4. package/dist/chunk-4ESUQQVB.js.map +1 -0
  5. package/dist/{chunk-TW6NZHX6.cjs → chunk-MXC77W6F.cjs} +35 -35
  6. package/dist/{chunk-TW6NZHX6.cjs.map → chunk-MXC77W6F.cjs.map} +1 -1
  7. package/dist/{chunk-7CUHIALJ.cjs → chunk-O2Y6XX3B.cjs} +17 -17
  8. package/dist/{chunk-7CUHIALJ.cjs.map → chunk-O2Y6XX3B.cjs.map} +1 -1
  9. package/dist/{chunk-PM6MZZRD.cjs → chunk-OH3WQGPX.cjs} +266 -357
  10. package/dist/chunk-OH3WQGPX.cjs.map +1 -0
  11. package/dist/{chunk-KEDZU7VZ.cjs → chunk-PB6WTEP5.cjs} +4 -4
  12. package/dist/{chunk-KEDZU7VZ.cjs.map → chunk-PB6WTEP5.cjs.map} +1 -1
  13. package/dist/index.cjs +38 -34
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +7 -4
  16. package/dist/index.d.ts +7 -4
  17. package/dist/index.js +8 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/{logger-DvbHXjIO.d.cts → logger-BWq-oJU_.d.cts} +3 -2
  20. package/dist/{logger-DvbHXjIO.d.ts → logger-BWq-oJU_.d.ts} +3 -2
  21. package/dist/logger.cjs +6 -6
  22. package/dist/logger.d.cts +2 -1
  23. package/dist/logger.d.ts +2 -1
  24. package/dist/logger.js +1 -1
  25. package/dist/mocks.cjs +9 -9
  26. package/dist/mocks.d.cts +3 -2
  27. package/dist/mocks.d.ts +3 -2
  28. package/dist/{prompt-OGHA3VNC.cjs → prompt-HPGUKPZV.cjs} +4 -4
  29. package/dist/{prompt-OGHA3VNC.cjs.map → prompt-HPGUKPZV.cjs.map} +1 -1
  30. package/dist/transformers.cjs +22 -22
  31. package/dist/utils.cjs +17 -17
  32. package/dist/utils.d.cts +2 -1
  33. package/dist/utils.d.ts +2 -1
  34. package/package.json +7 -8
  35. package/src/build.ts +6 -1
  36. package/src/index.ts +1 -1
  37. package/src/logger.ts +11 -24
  38. package/dist/chunk-CK6IAYQK.js.map +0 -1
  39. package/dist/chunk-PM6MZZRD.cjs.map +0 -1
@@ -2,90 +2,90 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var chunk7CUHIALJ_cjs = require('./chunk-7CUHIALJ.cjs');
6
- require('./chunk-KEDZU7VZ.cjs');
5
+ var chunkO2Y6XX3B_cjs = require('./chunk-O2Y6XX3B.cjs');
6
+ require('./chunk-PB6WTEP5.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "camelCase", {
11
11
  enumerable: true,
12
- get: function () { return chunk7CUHIALJ_cjs.camelCase; }
12
+ get: function () { return chunkO2Y6XX3B_cjs.camelCase; }
13
13
  });
14
14
  Object.defineProperty(exports, "combineCodes", {
15
15
  enumerable: true,
16
- get: function () { return chunk7CUHIALJ_cjs.combineCodes; }
16
+ get: function () { return chunkO2Y6XX3B_cjs.combineCodes; }
17
17
  });
18
18
  Object.defineProperty(exports, "createIndent", {
19
19
  enumerable: true,
20
- get: function () { return chunk7CUHIALJ_cjs.createIndent; }
20
+ get: function () { return chunkO2Y6XX3B_cjs.createIndent; }
21
21
  });
22
22
  Object.defineProperty(exports, "createJSDocBlockText", {
23
23
  enumerable: true,
24
- get: function () { return chunk7CUHIALJ_cjs.createJSDocBlockText; }
24
+ get: function () { return chunkO2Y6XX3B_cjs.createJSDocBlockText; }
25
25
  });
26
26
  Object.defineProperty(exports, "default", {
27
27
  enumerable: true,
28
- get: function () { return chunk7CUHIALJ_cjs.transformers_default; }
28
+ get: function () { return chunkO2Y6XX3B_cjs.transformers_default; }
29
29
  });
30
30
  Object.defineProperty(exports, "escape", {
31
31
  enumerable: true,
32
- get: function () { return chunk7CUHIALJ_cjs.escape; }
32
+ get: function () { return chunkO2Y6XX3B_cjs.escape; }
33
33
  });
34
34
  Object.defineProperty(exports, "isValidVarName", {
35
35
  enumerable: true,
36
- get: function () { return chunk7CUHIALJ_cjs.isValidVarName; }
36
+ get: function () { return chunkO2Y6XX3B_cjs.isValidVarName; }
37
37
  });
38
38
  Object.defineProperty(exports, "jsStringEscape", {
39
39
  enumerable: true,
40
- get: function () { return chunk7CUHIALJ_cjs.jsStringEscape; }
40
+ get: function () { return chunkO2Y6XX3B_cjs.jsStringEscape; }
41
41
  });
42
42
  Object.defineProperty(exports, "merge", {
43
43
  enumerable: true,
44
- get: function () { return chunk7CUHIALJ_cjs.merge; }
44
+ get: function () { return chunkO2Y6XX3B_cjs.merge; }
45
45
  });
46
46
  Object.defineProperty(exports, "nameSorter", {
47
47
  enumerable: true,
48
- get: function () { return chunk7CUHIALJ_cjs.nameSorter; }
48
+ get: function () { return chunkO2Y6XX3B_cjs.nameSorter; }
49
49
  });
50
50
  Object.defineProperty(exports, "orderBy", {
51
51
  enumerable: true,
52
- get: function () { return chunk7CUHIALJ_cjs.orderBy; }
52
+ get: function () { return chunkO2Y6XX3B_cjs.orderBy; }
53
53
  });
54
54
  Object.defineProperty(exports, "pascalCase", {
55
55
  enumerable: true,
56
- get: function () { return chunk7CUHIALJ_cjs.pascalCase; }
56
+ get: function () { return chunkO2Y6XX3B_cjs.pascalCase; }
57
57
  });
58
58
  Object.defineProperty(exports, "searchAndReplace", {
59
59
  enumerable: true,
60
- get: function () { return chunk7CUHIALJ_cjs.searchAndReplace; }
60
+ get: function () { return chunkO2Y6XX3B_cjs.searchAndReplace; }
61
61
  });
62
62
  Object.defineProperty(exports, "stringify", {
63
63
  enumerable: true,
64
- get: function () { return chunk7CUHIALJ_cjs.stringify; }
64
+ get: function () { return chunkO2Y6XX3B_cjs.stringify; }
65
65
  });
66
66
  Object.defineProperty(exports, "stringifyObject", {
67
67
  enumerable: true,
68
- get: function () { return chunk7CUHIALJ_cjs.stringifyObject; }
68
+ get: function () { return chunkO2Y6XX3B_cjs.stringifyObject; }
69
69
  });
70
70
  Object.defineProperty(exports, "toRegExp", {
71
71
  enumerable: true,
72
- get: function () { return chunk7CUHIALJ_cjs.toRegExp; }
72
+ get: function () { return chunkO2Y6XX3B_cjs.toRegExp; }
73
73
  });
74
74
  Object.defineProperty(exports, "toRegExpString", {
75
75
  enumerable: true,
76
- get: function () { return chunk7CUHIALJ_cjs.toRegExpString; }
76
+ get: function () { return chunkO2Y6XX3B_cjs.toRegExpString; }
77
77
  });
78
78
  Object.defineProperty(exports, "transformReservedWord", {
79
79
  enumerable: true,
80
- get: function () { return chunk7CUHIALJ_cjs.transformReservedWord; }
80
+ get: function () { return chunkO2Y6XX3B_cjs.transformReservedWord; }
81
81
  });
82
82
  Object.defineProperty(exports, "trim", {
83
83
  enumerable: true,
84
- get: function () { return chunk7CUHIALJ_cjs.trim; }
84
+ get: function () { return chunkO2Y6XX3B_cjs.trim; }
85
85
  });
86
86
  Object.defineProperty(exports, "trimQuotes", {
87
87
  enumerable: true,
88
- get: function () { return chunk7CUHIALJ_cjs.trimQuotes; }
88
+ get: function () { return chunkO2Y6XX3B_cjs.trimQuotes; }
89
89
  });
90
90
  //# sourceMappingURL=transformers.cjs.map
91
91
  //# sourceMappingURL=transformers.cjs.map
package/dist/utils.cjs CHANGED
@@ -1,66 +1,66 @@
1
1
  'use strict';
2
2
 
3
- var chunkTW6NZHX6_cjs = require('./chunk-TW6NZHX6.cjs');
4
- require('./chunk-7CUHIALJ.cjs');
5
- require('./chunk-KEDZU7VZ.cjs');
3
+ var chunkMXC77W6F_cjs = require('./chunk-MXC77W6F.cjs');
4
+ require('./chunk-O2Y6XX3B.cjs');
5
+ require('./chunk-PB6WTEP5.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "FunctionParams", {
10
10
  enumerable: true,
11
- get: function () { return chunkTW6NZHX6_cjs.FunctionParams; }
11
+ get: function () { return chunkMXC77W6F_cjs.FunctionParams; }
12
12
  });
13
13
  Object.defineProperty(exports, "URLPath", {
14
14
  enumerable: true,
15
- get: function () { return chunkTW6NZHX6_cjs.URLPath; }
15
+ get: function () { return chunkMXC77W6F_cjs.URLPath; }
16
16
  });
17
17
  Object.defineProperty(exports, "createFile", {
18
18
  enumerable: true,
19
- get: function () { return chunkTW6NZHX6_cjs.createFile; }
19
+ get: function () { return chunkMXC77W6F_cjs.createFile; }
20
20
  });
21
21
  Object.defineProperty(exports, "createFileExport", {
22
22
  enumerable: true,
23
- get: function () { return chunkTW6NZHX6_cjs.createFileExport; }
23
+ get: function () { return chunkMXC77W6F_cjs.createFileExport; }
24
24
  });
25
25
  Object.defineProperty(exports, "createFileImport", {
26
26
  enumerable: true,
27
- get: function () { return chunkTW6NZHX6_cjs.createFileImport; }
27
+ get: function () { return chunkMXC77W6F_cjs.createFileImport; }
28
28
  });
29
29
  Object.defineProperty(exports, "createFileParser", {
30
30
  enumerable: true,
31
- get: function () { return chunkTW6NZHX6_cjs.createFileParser; }
31
+ get: function () { return chunkMXC77W6F_cjs.createFileParser; }
32
32
  });
33
33
  Object.defineProperty(exports, "getFileParser", {
34
34
  enumerable: true,
35
- get: function () { return chunkTW6NZHX6_cjs.getFileParser; }
35
+ get: function () { return chunkMXC77W6F_cjs.getFileParser; }
36
36
  });
37
37
  Object.defineProperty(exports, "getUniqueName", {
38
38
  enumerable: true,
39
- get: function () { return chunkTW6NZHX6_cjs.getUniqueName; }
39
+ get: function () { return chunkMXC77W6F_cjs.getUniqueName; }
40
40
  });
41
41
  Object.defineProperty(exports, "isPromise", {
42
42
  enumerable: true,
43
- get: function () { return chunkTW6NZHX6_cjs.isPromise; }
43
+ get: function () { return chunkMXC77W6F_cjs.isPromise; }
44
44
  });
45
45
  Object.defineProperty(exports, "isPromiseFulfilledResult", {
46
46
  enumerable: true,
47
- get: function () { return chunkTW6NZHX6_cjs.isPromiseFulfilledResult; }
47
+ get: function () { return chunkMXC77W6F_cjs.isPromiseFulfilledResult; }
48
48
  });
49
49
  Object.defineProperty(exports, "isPromiseRejectedResult", {
50
50
  enumerable: true,
51
- get: function () { return chunkTW6NZHX6_cjs.isPromiseRejectedResult; }
51
+ get: function () { return chunkMXC77W6F_cjs.isPromiseRejectedResult; }
52
52
  });
53
53
  Object.defineProperty(exports, "renderTemplate", {
54
54
  enumerable: true,
55
- get: function () { return chunkTW6NZHX6_cjs.renderTemplate; }
55
+ get: function () { return chunkMXC77W6F_cjs.renderTemplate; }
56
56
  });
57
57
  Object.defineProperty(exports, "setUniqueName", {
58
58
  enumerable: true,
59
- get: function () { return chunkTW6NZHX6_cjs.setUniqueName; }
59
+ get: function () { return chunkMXC77W6F_cjs.setUniqueName; }
60
60
  });
61
61
  Object.defineProperty(exports, "timeout", {
62
62
  enumerable: true,
63
- get: function () { return chunkTW6NZHX6_cjs.timeout; }
63
+ get: function () { return chunkMXC77W6F_cjs.timeout; }
64
64
  });
65
65
  //# sourceMappingURL=utils.cjs.map
66
66
  //# sourceMappingURL=utils.cjs.map
package/dist/utils.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { PossiblePromise } from '@kubb/types';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { L as Logger } from './logger-DvbHXjIO.cjs';
3
+ import { L as Logger } from './logger-BWq-oJU_.cjs';
4
+ import 'consola/utils';
4
5
  import 'consola';
5
6
 
6
7
  type FunctionParamsASTWithoutType = {
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { PossiblePromise } from '@kubb/types';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { L as Logger } from './logger-DvbHXjIO.js';
3
+ import { L as Logger } from './logger-BWq-oJU_.js';
4
+ import 'consola/utils';
4
5
  import 'consola';
5
6
 
6
7
  type FunctionParamsASTWithoutType = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "3.7.1",
3
+ "version": "3.7.3",
4
4
  "description": "Generator core",
5
5
  "keywords": [
6
6
  "typescript",
@@ -83,9 +83,9 @@
83
83
  "remeda": "^2.21.2",
84
84
  "seedrandom": "^3.0.5",
85
85
  "semver": "^7.7.1",
86
- "@kubb/fs": "3.7.1",
87
- "@kubb/parser-ts": "3.7.1",
88
- "@kubb/types": "3.7.1"
86
+ "@kubb/fs": "3.7.3",
87
+ "@kubb/parser-ts": "3.7.3",
88
+ "@kubb/types": "3.7.3"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@types/object-hash": "^3.0.6",
@@ -93,11 +93,10 @@
93
93
  "@types/semver": "^7.7.0",
94
94
  "consola": "^3.4.2",
95
95
  "prettier": "^3.5.3",
96
- "tinyrainbow": "^1.2.0",
97
96
  "tsup": "^8.4.0",
98
- "typescript": "^5.8.2",
99
- "@kubb/config-ts": "3.7.1",
100
- "@kubb/config-tsup": "3.7.1"
97
+ "typescript": "^5.8.3",
98
+ "@kubb/config-ts": "3.7.3",
99
+ "@kubb/config-tsup": "3.7.3"
101
100
  },
102
101
  "engines": {
103
102
  "node": ">=20"
package/src/build.ts CHANGED
@@ -17,6 +17,7 @@ type BuildOptions = {
17
17
  * @default Logger without the spinner
18
18
  */
19
19
  logger?: Logger
20
+ pluginManager?: PluginManager
20
21
  }
21
22
 
22
23
  type BuildOutput = {
@@ -28,7 +29,11 @@ type BuildOutput = {
28
29
  error?: Error
29
30
  }
30
31
 
31
- async function setup(options: BuildOptions): Promise<PluginManager> {
32
+ export async function setup(options: BuildOptions): Promise<PluginManager> {
33
+ if (options.pluginManager) {
34
+ return options.pluginManager
35
+ }
36
+
32
37
  const { config: userConfig, logger = createLogger() } = options
33
38
 
34
39
  try {
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { build, build as default, safeBuild } from './build.ts'
1
+ export { setup, build, build as default, safeBuild } from './build.ts'
2
2
  export { defineConfig, isInputPath } from './config.ts'
3
3
  export { FileManager, getSource, processFiles } from './FileManager.ts'
4
4
  export type { FileMetaBase } from './FileManager.ts'
package/src/logger.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import seedrandom from 'seedrandom'
2
- import c, { createColors } from 'tinyrainbow'
2
+ import { colors } from 'consola/utils'
3
3
 
4
4
  import { EventEmitter } from './utils/EventEmitter.ts'
5
5
 
6
6
  import { resolve } from 'node:path'
7
7
  import { write } from '@kubb/fs'
8
8
  import { type ConsolaInstance, type LogLevel, createConsola } from 'consola'
9
- import type { Formatter } from 'tinyrainbow'
10
9
 
11
10
  type DebugEvent = { date: Date; logs: string[]; fileName?: string }
12
11
 
@@ -74,11 +73,11 @@ export function createLogger({ logLevel = 3, name, consola: _consola }: Props =
74
73
  })
75
74
 
76
75
  events.on('warning', (message) => {
77
- consola.warn(c.yellow(message))
76
+ consola.warn(colors.yellow(message))
78
77
  })
79
78
 
80
79
  events.on('info', (message) => {
81
- consola.info(c.yellow(message))
80
+ consola.info(colors.yellow(message))
82
81
  })
83
82
 
84
83
  events.on('debug', (message) => {
@@ -135,37 +134,25 @@ export function createLogger({ logLevel = 3, name, consola: _consola }: Props =
135
134
  return logger
136
135
  }
137
136
 
138
- const defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const
139
-
140
- export function randomColour(text?: string, colours = defaultColours): string {
137
+ export function randomColour(text?: string): keyof typeof colors {
141
138
  if (!text) {
142
139
  return 'white'
143
140
  }
144
141
 
142
+ const defaultColours = ['black', 'red', 'green', 'yellow', 'blue', 'red', 'green', 'magenta', 'cyan', 'gray'] as const
143
+
145
144
  const random = seedrandom(text)
146
- const colour = colours.at(Math.floor(random() * colours.length)) || 'white'
145
+ const colour = defaultColours.at(Math.floor(random() * defaultColours.length)) || 'white'
147
146
 
148
147
  return colour
149
148
  }
150
149
 
151
- export function randomCliColour(text?: string, colors = defaultColours): string {
152
- const colours = createColors(true)
153
-
150
+ export function randomCliColour(text?: string): string {
154
151
  if (!text) {
155
- return colours.white(text)
152
+ return ''
156
153
  }
157
154
 
158
- const colour = randomColour(text, colors)
159
- const isDark = colour.includes('dark')
160
- const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours
161
- const formatter: Formatter = colours[key] as Formatter
155
+ const colour = randomColour(text)
162
156
 
163
- if (isDark) {
164
- return c.bold(formatter(text))
165
- }
166
-
167
- if (typeof formatter !== 'function') {
168
- throw new Error('Formatter for picoColor is not of type function/Formatter')
169
- }
170
- return formatter(text)
157
+ return colors[colour]?.(text)
171
158
  }