@kubb/cli 1.1.11 → 1.1.13
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/bin/kubb.js +8 -1
- package/dist/index.cjs +126 -102
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +127 -103
- package/dist/index.js.map +1 -0
- package/package.json +6 -6
- package/src/index.ts +0 -69
- package/src/init.ts +0 -91
- package/src/run.ts +0 -179
- package/src/types.ts +0 -7
- package/src/utils/OraWritable.ts +0 -20
- package/src/utils/getConfig.ts +0 -28
- package/src/utils/getCosmiConfig.ts +0 -80
- package/src/utils/getPlugins.ts +0 -40
- package/src/utils/importModule.ts +0 -36
- package/src/utils/index.ts +0 -8
- package/src/utils/mocks/noop.cjs +0 -3
- package/src/utils/mocks/noop.js +0 -3
- package/src/utils/parseHrtimeToSeconds.ts +0 -4
- package/src/utils/parseText.ts +0 -5
- package/src/utils/watcher.ts +0 -30
package/bin/kubb.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
var pathParser = require('path');
|
|
@@ -7,7 +6,6 @@ var ora = require('ora');
|
|
|
7
6
|
var pc3 = require('picocolors');
|
|
8
7
|
var core = require('@kubb/core');
|
|
9
8
|
var execa = require('execa');
|
|
10
|
-
var PrettyError = require('pretty-error');
|
|
11
9
|
var stringArgv = require('string-argv');
|
|
12
10
|
var stream = require('stream');
|
|
13
11
|
var mod = require('module');
|
|
@@ -15,16 +13,17 @@ var url = require('url');
|
|
|
15
13
|
var cosmiconfig = require('cosmiconfig');
|
|
16
14
|
var tsNode = require('ts-node');
|
|
17
15
|
var yaml = require('yaml');
|
|
16
|
+
var PrettyError = require('pretty-error');
|
|
18
17
|
|
|
19
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
|
|
21
20
|
var pathParser__default = /*#__PURE__*/_interopDefault(pathParser);
|
|
22
21
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
23
22
|
var pc3__default = /*#__PURE__*/_interopDefault(pc3);
|
|
24
|
-
var PrettyError__default = /*#__PURE__*/_interopDefault(PrettyError);
|
|
25
23
|
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
26
24
|
var tsNode__default = /*#__PURE__*/_interopDefault(tsNode);
|
|
27
25
|
var yaml__default = /*#__PURE__*/_interopDefault(yaml);
|
|
26
|
+
var PrettyError__default = /*#__PURE__*/_interopDefault(PrettyError);
|
|
28
27
|
|
|
29
28
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
30
29
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -35,7 +34,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
35
34
|
});
|
|
36
35
|
|
|
37
36
|
// package.json
|
|
38
|
-
var version = "1.1.
|
|
37
|
+
var version = "1.1.13";
|
|
39
38
|
var presets = {
|
|
40
39
|
simple: {
|
|
41
40
|
"kubb.config": `
|
|
@@ -64,29 +63,23 @@ export default defineConfig({
|
|
|
64
63
|
}
|
|
65
64
|
};
|
|
66
65
|
async function init({ spinner: spinner2, preset = "simple", logLevel = "silent", packageManager = "pnpm" }) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
data.forEach((text) => console.log(text));
|
|
85
|
-
}
|
|
86
|
-
} catch (error) {
|
|
87
|
-
spinner2.fail(pc3__default.default.red(`Something went wrong
|
|
88
|
-
|
|
89
|
-
${error?.message}`));
|
|
66
|
+
const presetMeta = presets[preset];
|
|
67
|
+
const path = pathParser__default.default.resolve(process.cwd(), "./kubb.config.js");
|
|
68
|
+
const installCommand = packageManager === "npm" ? "install" : "add";
|
|
69
|
+
spinner2.start(`\u{1F4C0} Writing \`kubb.config.js\` ${pc3__default.default.dim(path)}`);
|
|
70
|
+
await core.write(presetMeta["kubb.config"], path);
|
|
71
|
+
spinner2.succeed(`\u{1F4C0} Wrote \`kubb.config.js\` ${pc3__default.default.dim(path)}`);
|
|
72
|
+
const data = await Promise.all([
|
|
73
|
+
execa.$`npm init es6 -y`,
|
|
74
|
+
...presetMeta.packages.map(async (pack) => {
|
|
75
|
+
spinner2.start(`\u{1F4C0} Installing ${pc3__default.default.dim(pack)}`);
|
|
76
|
+
const { stdout } = await execa.$({ preferLocal: false })`${packageManager} ${installCommand} ${pack}`;
|
|
77
|
+
spinner2.succeed(`\u{1F4C0} Installed ${pc3__default.default.dim(pack)}`);
|
|
78
|
+
return stdout;
|
|
79
|
+
})
|
|
80
|
+
]);
|
|
81
|
+
if (logLevel === "info") {
|
|
82
|
+
data.forEach((text) => console.log(text));
|
|
90
83
|
}
|
|
91
84
|
}
|
|
92
85
|
|
|
@@ -117,26 +110,22 @@ ${pc3__default.default.bold(pc3__default.default.blue(this.command))}: ${chunk?.
|
|
|
117
110
|
};
|
|
118
111
|
|
|
119
112
|
// src/run.ts
|
|
120
|
-
async function run({ config, options
|
|
113
|
+
async function run({ config, options }) {
|
|
121
114
|
const hrstart = process.hrtime();
|
|
122
115
|
const [log] = core.throttle((message, { logLevel, params }) => {
|
|
123
116
|
if (logLevel === "error") {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
` || `Something went wrong
|
|
127
|
-
|
|
128
|
-
`));
|
|
117
|
+
throw new Error(message || "Something went wrong");
|
|
129
118
|
} else if (logLevel === "info") {
|
|
130
119
|
if (message) {
|
|
131
|
-
|
|
120
|
+
spinner.text = message;
|
|
132
121
|
} else {
|
|
133
|
-
|
|
122
|
+
spinner.text = `\u{1FA82} Executing ${params?.hookName || "unknown"}(${pc3__default.default.yellow(params?.pluginName || "unknown")})`;
|
|
134
123
|
}
|
|
135
124
|
}
|
|
136
125
|
}, 100);
|
|
137
126
|
const logger = {
|
|
138
127
|
log,
|
|
139
|
-
spinner
|
|
128
|
+
spinner
|
|
140
129
|
};
|
|
141
130
|
const onDone = async (hooks, logLevel) => {
|
|
142
131
|
if (!hooks?.done) {
|
|
@@ -149,23 +138,25 @@ async function run({ config, options, spinner: spinner2 }) {
|
|
|
149
138
|
commands = hooks.done;
|
|
150
139
|
}
|
|
151
140
|
const promises = commands.map(async (command) => {
|
|
152
|
-
const oraWritable = new OraWritable(
|
|
141
|
+
const oraWritable = new OraWritable(spinner, command);
|
|
153
142
|
const [cmd, ..._args] = [...stringArgv.parseArgsStringToArgv(command)];
|
|
154
|
-
|
|
143
|
+
spinner.start(parseText(`\u{1FA82} Executing hooks(${pc3__default.default.yellow("done")})`, { info: ` ${pc3__default.default.dim(command)}` }, logLevel));
|
|
155
144
|
const { stdout } = await execa.execa(cmd, _args, {}).pipeStdout(oraWritable);
|
|
156
|
-
|
|
145
|
+
spinner.suffixText = "";
|
|
157
146
|
oraWritable.destroy();
|
|
147
|
+
await core.timeout(50);
|
|
158
148
|
if (logLevel === "info") {
|
|
159
|
-
|
|
149
|
+
spinner.succeed(parseText(`\u{1FA82} Executing hooks(${pc3__default.default.yellow("done")})`, { info: ` ${pc3__default.default.dim(command)}` }, logLevel));
|
|
160
150
|
console.log(stdout);
|
|
161
151
|
}
|
|
162
152
|
});
|
|
163
153
|
await Promise.all(promises);
|
|
164
154
|
if (logLevel === "silent") {
|
|
165
|
-
|
|
155
|
+
spinner.succeed(parseText(`\u{1FA82} Executing hooks(${pc3__default.default.yellow("done")})`, {}, logLevel));
|
|
166
156
|
}
|
|
167
157
|
};
|
|
168
|
-
const
|
|
158
|
+
const getSummary = (pluginManager, status) => {
|
|
159
|
+
const logs = [];
|
|
169
160
|
const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart));
|
|
170
161
|
const buildStartPlugins = [
|
|
171
162
|
...new Set(pluginManager.executed.filter((item) => item.hookName === "buildStart" && item.plugin.name !== "core").map((item) => item.plugin.name))
|
|
@@ -184,44 +175,30 @@ async function run({ config, options, spinner: spinner2 }) {
|
|
|
184
175
|
return 0;
|
|
185
176
|
});
|
|
186
177
|
const meta = {
|
|
187
|
-
plugins: status === "success" ? `${pc3__default.default.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total` : `${pc3__default.default.red(`${pluginsCount - buildStartPlugins.length} failed`)}, ${pluginsCount} total`,
|
|
178
|
+
plugins: status === "success" ? `${pc3__default.default.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total` : `${pc3__default.default.red(`${pluginsCount - buildStartPlugins.length + 1} failed`)}, ${pluginsCount} total`,
|
|
188
179
|
filesCreated: files.length,
|
|
189
180
|
time: pc3__default.default.yellow(`${elapsedSeconds}s`),
|
|
190
181
|
output: pathParser__default.default.resolve(config.root, config.output.path)
|
|
191
182
|
};
|
|
192
|
-
|
|
183
|
+
if (options.debug) {
|
|
184
|
+
logs.push(pc3__default.default.bold("Generated files:\n"));
|
|
185
|
+
logs.push(files.map((file) => `${pc3__default.default.blue(file.meta?.pluginName)} ${file.path}`).join("\n"));
|
|
186
|
+
}
|
|
187
|
+
logs.push(`
|
|
188
|
+
|
|
193
189
|
${pc3__default.default.bold("Plugins:")} ${meta.plugins}
|
|
194
190
|
${pc3__default.default.bold("Generated:")} ${meta.filesCreated} files
|
|
195
191
|
${pc3__default.default.bold("Time:")} ${meta.time}
|
|
196
192
|
${pc3__default.default.bold("Output:")} ${meta.output}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
console.log(`${files.map((file) => `${pc3__default.default.blue(file.meta?.pluginName)} ${file.path}`).join("\n")}`);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
const printErrors = (error) => {
|
|
204
|
-
const pe = new PrettyError__default.default();
|
|
205
|
-
if (options.debug) {
|
|
206
|
-
spinner2.fail(pc3__default.default.red(`Something went wrong
|
|
207
|
-
|
|
208
|
-
`));
|
|
209
|
-
const causedError = error?.cause;
|
|
210
|
-
console.log(pe.render(error));
|
|
211
|
-
if (causedError) {
|
|
212
|
-
console.log(pe.render(causedError));
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
spinner2.fail(pc3__default.default.red(`Something went wrong
|
|
216
|
-
|
|
217
|
-
${error?.message}`));
|
|
218
|
-
}
|
|
193
|
+
|
|
194
|
+
`);
|
|
195
|
+
return logs;
|
|
219
196
|
};
|
|
220
197
|
try {
|
|
221
198
|
const { root, ...userConfig } = config;
|
|
222
199
|
const logLevel = options.logLevel ?? userConfig.logLevel ?? "silent";
|
|
223
200
|
const inputPath = options.input ?? userConfig.input.path;
|
|
224
|
-
|
|
201
|
+
spinner.start(parseText(`\u{1F680} Building`, { info: `(${pc3__default.default.dim(inputPath)})` }, logLevel));
|
|
225
202
|
const output = await core.build({
|
|
226
203
|
config: {
|
|
227
204
|
root: process.cwd(),
|
|
@@ -238,19 +215,16 @@ ${error?.message}`));
|
|
|
238
215
|
},
|
|
239
216
|
logger
|
|
240
217
|
});
|
|
241
|
-
|
|
218
|
+
spinner.succeed(parseText(`\u{1F680} Build completed`, { info: `(${pc3__default.default.dim(inputPath)})` }, logLevel));
|
|
242
219
|
await onDone(config.hooks, logLevel);
|
|
243
|
-
|
|
220
|
+
const summary = getSummary(output.pluginManager, "success");
|
|
221
|
+
console.log(summary.join(""));
|
|
244
222
|
} catch (error) {
|
|
245
|
-
if (error instanceof core.ParallelPluginError) {
|
|
246
|
-
error.errors.map((e) => printErrors(e));
|
|
247
|
-
} else {
|
|
248
|
-
printErrors(error);
|
|
249
|
-
}
|
|
250
223
|
if (error instanceof core.PluginError || error instanceof core.ParallelPluginError) {
|
|
251
|
-
|
|
224
|
+
const summary = getSummary(error.pluginManager, "failed");
|
|
225
|
+
throw new core.SummaryError("Something went wrong\n", { cause: error, summary });
|
|
252
226
|
}
|
|
253
|
-
throw error;
|
|
227
|
+
throw new core.SummaryError("Something went wrong\n", { cause: error });
|
|
254
228
|
}
|
|
255
229
|
}
|
|
256
230
|
var SLASHES = /* @__PURE__ */ new Set(["/", "\\"]);
|
|
@@ -318,8 +292,7 @@ async function getConfig(result, options) {
|
|
|
318
292
|
};
|
|
319
293
|
return JSONConfig;
|
|
320
294
|
}
|
|
321
|
-
async function startWatcher(
|
|
322
|
-
const { spinner: spinner2, path } = options;
|
|
295
|
+
async function startWatcher(path, cb) {
|
|
323
296
|
const { watch } = await import('chokidar');
|
|
324
297
|
const ignored = ["**/{.git,node_modules}/**"];
|
|
325
298
|
const watcher = watch(path, {
|
|
@@ -327,12 +300,12 @@ async function startWatcher(cb, options) {
|
|
|
327
300
|
ignored
|
|
328
301
|
});
|
|
329
302
|
watcher.on("all", (type, file) => {
|
|
330
|
-
|
|
331
|
-
|
|
303
|
+
spinner.succeed(pc3__default.default.yellow(pc3__default.default.bold(`Change detected: ${type} ${file}`)));
|
|
304
|
+
spinner.spinner = "clock";
|
|
332
305
|
try {
|
|
333
|
-
cb(
|
|
306
|
+
cb(path);
|
|
334
307
|
} catch (e) {
|
|
335
|
-
|
|
308
|
+
spinner.warn(pc3__default.default.red("Watcher failed"));
|
|
336
309
|
}
|
|
337
310
|
});
|
|
338
311
|
}
|
|
@@ -355,7 +328,6 @@ var tsLoader = (configFile) => {
|
|
|
355
328
|
throw new Error(`'ts-node' is required for the TypeScript configuration files. Make sure it is installed
|
|
356
329
|
Error: ${err.message}`);
|
|
357
330
|
}
|
|
358
|
-
console.log(err);
|
|
359
331
|
throw err;
|
|
360
332
|
} finally {
|
|
361
333
|
registerer.enabled();
|
|
@@ -370,12 +342,10 @@ async function getCosmiConfig(moduleName2, config) {
|
|
|
370
342
|
`.${moduleName2}rc.json`,
|
|
371
343
|
`.${moduleName2}rc.yaml`,
|
|
372
344
|
`.${moduleName2}rc.yml`,
|
|
373
|
-
// TODO fix tsLoader
|
|
374
345
|
`.${moduleName2}rc.ts`,
|
|
375
346
|
`.${moduleName2}rc.js`,
|
|
376
347
|
`.${moduleName2}rc.cjs`,
|
|
377
348
|
`.${moduleName2}rc.mjs`,
|
|
378
|
-
// TODO fix tsLoader
|
|
379
349
|
`${moduleName2}.config.ts`,
|
|
380
350
|
`${moduleName2}.config.js`,
|
|
381
351
|
`${moduleName2}.config.cjs`,
|
|
@@ -397,14 +367,58 @@ async function getCosmiConfig(moduleName2, config) {
|
|
|
397
367
|
}
|
|
398
368
|
return result;
|
|
399
369
|
}
|
|
400
|
-
|
|
401
|
-
|
|
370
|
+
var prettyError = new PrettyError__default.default().skipPackage("commander").skip(function(traceLine, lineNumber) {
|
|
371
|
+
const pattern = new RegExp("renderErrors");
|
|
372
|
+
const hasMatch = traceLine?.file?.match(pattern);
|
|
373
|
+
if (typeof traceLine.packageName !== "undefined" && hasMatch) {
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
}).start();
|
|
377
|
+
function getErrorCauses(errors) {
|
|
378
|
+
return errors.reduce((prev, error) => {
|
|
379
|
+
const causedError = error?.cause;
|
|
380
|
+
if (causedError) {
|
|
381
|
+
prev = [...prev, ...getErrorCauses([causedError])];
|
|
382
|
+
}
|
|
383
|
+
prev = [...prev, prettyError.render(error)];
|
|
384
|
+
return prev;
|
|
385
|
+
}, []).filter(Boolean);
|
|
386
|
+
}
|
|
387
|
+
function renderErrors(error, { prefixText, debug = false }) {
|
|
388
|
+
if (!error) {
|
|
389
|
+
return "";
|
|
390
|
+
}
|
|
391
|
+
if (error instanceof core.ParallelPluginError) {
|
|
392
|
+
return [prefixText, ...error.errors.map((e) => renderErrors(e, { debug }))].filter(Boolean).join("\n");
|
|
393
|
+
}
|
|
394
|
+
if (debug) {
|
|
395
|
+
const errors = getErrorCauses([error]);
|
|
396
|
+
return [prefixText, ...errors].filter(Boolean).join("\n");
|
|
397
|
+
}
|
|
398
|
+
prettyError.skipNodeFiles();
|
|
399
|
+
prettyError.skip(function() {
|
|
400
|
+
return true;
|
|
401
|
+
});
|
|
402
|
+
return [prefixText, prettyError.render(error.message)].filter(Boolean).join("\n");
|
|
403
|
+
}
|
|
402
404
|
var moduleName = "kubb";
|
|
403
405
|
var spinner = ora__default.default({
|
|
404
406
|
spinner: "clock"
|
|
405
|
-
})
|
|
406
|
-
var program = new commander.Command(moduleName).description("Kubb").
|
|
407
|
+
});
|
|
408
|
+
var program = new commander.Command(moduleName).name(moduleName).description("Kubb").version(version, "-v").exitOverride((err) => {
|
|
409
|
+
if (err instanceof commander.CommanderError) {
|
|
410
|
+
process.exit(1);
|
|
411
|
+
}
|
|
412
|
+
}).configureOutput({
|
|
413
|
+
outputError: (message, write2) => {
|
|
414
|
+
const options = program.opts();
|
|
415
|
+
write2(
|
|
416
|
+
renderErrors(new Error(message, { cause: void 0 }), { debug: options.debug, prefixText: pc3__default.default.red("Something went wrong with processing the CLI\n") }) + "\n"
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
}).action(async (options) => {
|
|
407
420
|
try {
|
|
421
|
+
spinner.start();
|
|
408
422
|
if (options.init) {
|
|
409
423
|
spinner.start("\u{1F4E6} Initializing Kubb");
|
|
410
424
|
await init({ spinner, logLevel: options.logLevel });
|
|
@@ -416,23 +430,33 @@ var program = new commander.Command(moduleName).description("Kubb").action(async
|
|
|
416
430
|
spinner.succeed(`\u{1F4BE} Config loaded(${pc3__default.default.dim(pathParser__default.default.relative(process.cwd(), result.filepath))})`);
|
|
417
431
|
if (options.watch) {
|
|
418
432
|
const config = await getConfig(result, options);
|
|
419
|
-
startWatcher(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
spinner,
|
|
427
|
-
path: [config.input.path]
|
|
428
|
-
}
|
|
429
|
-
);
|
|
433
|
+
startWatcher([config.input.path], async (paths) => {
|
|
434
|
+
await run({ config, options });
|
|
435
|
+
spinner.spinner = "simpleDotsScrolling";
|
|
436
|
+
spinner.start(pc3__default.default.yellow(pc3__default.default.bold(`Watching for changes in ${paths.join(" and ")}`)));
|
|
437
|
+
});
|
|
430
438
|
} else {
|
|
431
439
|
const config = await getConfig(result, options);
|
|
432
|
-
await run({ config,
|
|
440
|
+
await run({ config, options });
|
|
433
441
|
}
|
|
434
442
|
} catch (e) {
|
|
443
|
+
const originalError = e;
|
|
444
|
+
let error = originalError;
|
|
445
|
+
const summaryError = error instanceof core.SummaryError ? error : void 0;
|
|
446
|
+
if (summaryError) {
|
|
447
|
+
error = summaryError.cause;
|
|
448
|
+
}
|
|
449
|
+
const message = renderErrors(error, { debug: options.debug, prefixText: pc3__default.default.red(originalError?.message) });
|
|
450
|
+
spinner.fail([message, ...summaryError?.summary || []].join("\n"));
|
|
435
451
|
process.exit(1);
|
|
436
452
|
}
|
|
437
453
|
}).addOption(new commander.Option("-c, --config <path>", "Path to the Kubb config")).addOption(new commander.Option("-i, --input <path>", "Path of the input file(overrides the one in `kubb.config.js`)")).addOption(new commander.Option("-l, --logLevel <type>", "Type of the logging(overrides the one in `kubb.config.js`)").choices(["error", "info", "silent"])).addOption(new commander.Option("--init", "Init Kubb")).addOption(new commander.Option("-d, --debug", "Debug mode").default(false)).addOption(new commander.Option("-w, --watch", "Watch mode based on the input file"));
|
|
438
|
-
|
|
454
|
+
|
|
455
|
+
// src/index.ts
|
|
456
|
+
function runCLI(argv) {
|
|
457
|
+
return program.parse(argv);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
module.exports = runCLI;
|
|
461
|
+
//# sourceMappingURL=out.js.map
|
|
462
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/program.ts","../package.json","../src/init.ts","../src/run.ts","../src/utils/parseHrtimeToSeconds.ts","../src/utils/parseText.ts","../src/utils/OraWritable.ts","../src/utils/getConfig.ts","../src/utils/importModule.ts","../src/utils/getPlugins.ts","../src/utils/watcher.ts","../src/utils/getCosmiConfig.ts","../src/utils/renderErrors.ts","../src/index.ts"],"names":["pathParser","pc","spinner","require","moduleName","ParallelPluginError","SummaryError","write"],"mappings":";;;;;;;;;AAAA,OAAOA,iBAAgB;AAEvB,SAAS,SAAS,gBAAgB,cAAc;AAChD,OAAO,SAAS;AAChB,OAAOC,SAAQ;;;ACFb,cAAW;;;ACFb,OAAO,gBAAgB;AAEvB,SAAS,aAAa;AAEtB,SAAS,SAAS;AAClB,OAAO,QAAQ;AA8Bf,IAAM,UAAsC;AAAA,EAC1C,QAAQ;AAAA,IACN,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsBf,UAAU,CAAC,cAAc,aAAa,iBAAiB,oBAAoB,8BAA8B;AAAA,EAC3G;AACF;AAEA,eAAsB,KAAK,EAAE,SAAAC,UAAS,SAAS,UAAU,WAAW,UAAU,iBAAiB,OAAO,GAA4B;AAChI,QAAM,aAAa,QAAQ,MAAM;AACjC,QAAM,OAAO,WAAW,QAAQ,QAAQ,IAAI,GAAG,kBAAkB;AACjE,QAAM,iBAAiB,mBAAmB,QAAQ,YAAY;AAE9D,EAAAA,SAAQ,MAAM,wCAAiC,GAAG,IAAI,IAAI,GAAG;AAC7D,QAAM,MAAM,WAAW,aAAa,GAAG,IAAI;AAC3C,EAAAA,SAAQ,QAAQ,sCAA+B,GAAG,IAAI,IAAI,GAAG;AAE7D,QAAM,OAAO,MAAM,QAAQ,IAAI;AAAA,IAC7B;AAAA,IACA,GAAG,WAAW,SAAS,IAAI,OAAO,SAAS;AACzC,MAAAA,SAAQ,MAAM,wBAAiB,GAAG,IAAI,IAAI,GAAG;AAC7C,YAAM,EAAE,OAAO,IAAI,MAAM,EAAE,EAAE,aAAa,MAAM,CAAC,IAAI,kBAAkB,kBAAkB;AACzF,MAAAA,SAAQ,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O;AAE9C,YAAM,IAAI,EAAE,QAAQ,QAAQ,CAAC;AAAA,IAC/B;AAAA,EACF,SAAS,GAAP;AACA,UAAM,gBAAgB;AACtB,QAAI,QAAQ;AACZ,UAAM,eAAe,iBAAiBK,gBAAe,QAAQ;AAE7D,QAAI,cAAc;AAEhB,cAAQ,aAAa;AAAA,IACvB;AAEA,UAAM,UAAU,aAAa,OAAO,EAAE,OAAO,QAAQ,OAAO,YAAYL,IAAG,IAAI,eAAe,OAAO,EAAE,CAAC;AAExG,YAAQ,KAAK,CAAC,SAAS,GAAI,cAAc,WAAW,CAAC,CAAE,EAAE,KAAK,IAAI,CAAC;AACnE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC,EACA,UAAU,IAAI,OAAO,uBAAuB,yBAAyB,CAAC,EACtE,UAAU,IAAI,OAAO,sBAAsB,+DAA+D,CAAC,EAC3G,UAAU,IAAI,OAAO,yBAAyB,4DAA4D,EAAE,QAAQ,CAAC,SAAS,QAAQ,QAAQ,CAAC,CAAC,EAChJ,UAAU,IAAI,OAAO,UAAU,WAAW,CAAC,EAC3C,UAAU,IAAI,OAAO,eAAe,YAAY,EAAE,QAAQ,KAAK,CAAC,EAChE,UAAU,IAAI,OAAO,eAAe,oCAAoC,CAAC;;;AavF7D,SAAR,OAAwB,MAAmC;AAChE,SAAO,QAAQ,MAAM,IAAI;AAC3B","sourcesContent":["import pathParser from 'node:path'\n\nimport { Command, CommanderError, Option } from 'commander'\nimport ora from 'ora'\nimport pc from 'picocolors'\n\nimport { version } from '../package.json'\nimport { init } from './init.ts'\nimport { run } from './run.ts'\nimport { getConfig, getCosmiConfig, renderErrors, startWatcher } from './utils/index.ts'\n\nimport { SummaryError } from '@kubb/core'\nimport type { CLIOptions } from '@kubb/core'\n\nconst moduleName = 'kubb'\n\nexport const spinner = ora({\n spinner: 'clock',\n})\n\nexport const program = new Command(moduleName)\n .name(moduleName)\n .description('Kubb')\n .version(version, '-v')\n .exitOverride((err) => {\n if (err instanceof CommanderError) {\n process.exit(1)\n }\n })\n .configureOutput({\n outputError: (message, write) => {\n const options: CLIOptions = program.opts()\n\n write(\n renderErrors(new Error(message, { cause: undefined }), { debug: options.debug, prefixText: pc.red('Something went wrong with processing the CLI\\n') }) +\n '\\n'\n )\n },\n })\n .action(async (options: CLIOptions) => {\n try {\n spinner.start()\n\n if (options.init) {\n spinner.start('📦 Initializing Kubb')\n await init({ spinner, logLevel: options.logLevel })\n spinner.succeed(`📦 initialized Kubb`)\n return\n }\n\n // CONFIG\n spinner.start('💾 Loading config')\n const result = await getCosmiConfig(moduleName, options.config)\n spinner.succeed(`💾 Config loaded(${pc.dim(pathParser.relative(process.cwd(), result.filepath))})`)\n\n // END CONFIG\n\n if (options.watch) {\n const config = await getConfig(result, options)\n\n startWatcher([config.input.path], async (paths) => {\n await run({ config, options })\n spinner.spinner = 'simpleDotsScrolling'\n spinner.start(pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n } else {\n const config = await getConfig(result, options)\n\n await run({ config, options })\n }\n } catch (e: any) {\n const originalError = e as Error\n let error = originalError\n const summaryError = error instanceof SummaryError ? error : undefined\n\n if (summaryError) {\n // use the real error from summaryError and use the case of SummaryError to display a summary of plugins that failed\n error = summaryError.cause as Error\n }\n\n const message = renderErrors(error, { debug: options.debug, prefixText: pc.red(originalError?.message) })\n\n spinner.fail([message, ...(summaryError?.summary || [])].join('\\n'))\n process.exit(1)\n }\n })\n .addOption(new Option('-c, --config <path>', 'Path to the Kubb config'))\n .addOption(new Option('-i, --input <path>', 'Path of the input file(overrides the one in `kubb.config.js`)'))\n .addOption(new Option('-l, --logLevel <type>', 'Type of the logging(overrides the one in `kubb.config.js`)').choices(['error', 'info', 'silent']))\n .addOption(new Option('--init', 'Init Kubb'))\n .addOption(new Option('-d, --debug', 'Debug mode').default(false))\n .addOption(new Option('-w, --watch', 'Watch mode based on the input file'))\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"1.1.13\",\n \"description\": \"Generator cli\",\n \"keywords\": [\n \"typescript\",\n \"plugins\",\n \"kubb\",\n \"codegen\",\n \"cli\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/kubb-project/kubb.git\",\n \"directory\": \"packages/cli\"\n },\n \"license\": \"MIT\",\n \"author\": \"Stijn Van Hulle <stijn@stijnvanhulle.be\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"kubb\": \"bin/kubb.js\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rimraf ./dist\",\n \"lint\": \"eslint \\\"**/*.{ts,tsx}\\\"\",\n \"lint-fix\": \"bun run lint --quiet --fix\",\n \"release\": \"pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\",\n \"upgrade\": \"pnpm update\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@swc/core\": \"^1.3.63\",\n \"chokidar\": \"^3.5.3\",\n \"commander\": \"^10.0.1\",\n \"cosmiconfig\": \"^8.2.0\",\n \"execa\": \"^7.1.1\",\n \"ora\": \"^6.3.1\",\n \"picocolors\": \"^1.0.0\",\n \"pretty-error\": \"^4.0.0\",\n \"string-argv\": \"^0.3.2\",\n \"ts-node\": \"^10.9.1\",\n \"yaml\": \"^2.3.1\"\n },\n \"devDependencies\": {\n \"@kubb/swagger\": \"workspace:*\",\n \"@kubb/ts-config\": \"workspace:*\",\n \"@kubb/tsup-config\": \"workspace:*\",\n \"source-map-support\": \"^0.5.19\",\n \"@types/node\": \"^20.3.1\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.1.3\"\n },\n \"packageManager\": \"pnpm@8.3.0\",\n \"engines\": {\n \"node\": \">=18\",\n \"pnpm\": \">=8.3.0\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import pathParser from 'node:path'\n\nimport { write } from '@kubb/core'\n\nimport { $ } from 'execa'\nimport pc from 'picocolors'\n\nimport type { LogLevel } from '@kubb/core'\nimport type { Ora } from 'ora'\n\nexport type Preset = 'simple'\n\nexport type PackageManager = 'pnpm' | 'npm' | 'yarn'\n\nexport type PresetMeta = {\n 'kubb.config': string\n packages: string[]\n}\n\ntype RunProps = {\n spinner: Ora\n /**\n * @default `'silent'`\n */\n logLevel?: LogLevel\n /**\n * @default `'simple'`\n */\n preset?: Preset\n /**\n * @default `'pnpm'`\n */\n packageManager?: PackageManager\n}\n\nconst presets: Record<Preset, PresetMeta> = {\n simple: {\n 'kubb.config': `\nimport { defineConfig } from '@kubb/core'\nimport createSwagger from '@kubb/swagger'\nimport createSwaggerTS from '@kubb/swagger-ts'\nimport createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query'\n\nexport default defineConfig({\n root: '.',\n input: {\n path: 'https://petstore3.swagger.io/api/v3/openapi.json',\n },\n output: {\n path: './src/gen',\n clean: true,\n },\n hooks: {\n done: 'echo \"🎉 done\"',\n },\n logLevel: 'info',\n plugins: [createSwagger({}), createSwaggerTS({ output: 'models', enumType: 'enum' }), createSwaggerTanstackQuery({ output: './hooks' })],\n})\n `,\n packages: ['@kubb/core', '@kubb/cli', '@kubb/swagger', '@kubb/swagger-ts', '@kubb/swagger-tanstack-query'],\n },\n}\n\nexport async function init({ spinner, preset = 'simple', logLevel = 'silent', packageManager = 'pnpm' }: RunProps): Promise<void> {\n const presetMeta = presets[preset]\n const path = pathParser.resolve(process.cwd(), './kubb.config.js')\n const installCommand = packageManager === 'npm' ? 'install' : 'add'\n\n spinner.start(`📀 Writing \\`kubb.config.js\\` ${pc.dim(path)}`)\n await write(presetMeta['kubb.config'], path)\n spinner.succeed(`📀 Wrote \\`kubb.config.js\\` ${pc.dim(path)}`)\n\n const data = await Promise.all([\n $`npm init es6 -y`,\n ...presetMeta.packages.map(async (pack) => {\n spinner.start(`📀 Installing ${pc.dim(pack)}`)\n const { stdout } = await $({ preferLocal: false })`${packageManager} ${installCommand} ${pack}`\n spinner.succeed(`📀 Installed ${pc.dim(pack)}`)\n\n return stdout\n }),\n ])\n\n if (logLevel === 'info') {\n data.forEach((text) => console.log(text))\n }\n}\n","import pathParser from 'node:path'\n\nimport { build, throttle, ParallelPluginError, PluginError, SummaryError, timeout } from '@kubb/core'\n\nimport { execa } from 'execa'\nimport pc from 'picocolors'\n\nimport { parseArgsStringToArgv } from 'string-argv'\n\nimport { parseHrtimeToSeconds } from './utils/parseHrtimeToSeconds.ts'\nimport { parseText } from './utils/parseText.ts'\n\nimport type { BuildOutput, CLIOptions, KubbConfig, Logger, LogLevel } from '@kubb/core'\nimport { OraWritable } from './utils/OraWritable.ts'\nimport { spinner } from './program.ts'\n\ntype RunProps = {\n config: KubbConfig\n options: CLIOptions\n}\n\nexport async function run({ config, options }: RunProps): Promise<void> {\n const hrstart = process.hrtime()\n const [log] = throttle<void, Parameters<Logger['log']>>((message, { logLevel, params }) => {\n if (logLevel === 'error') {\n throw new Error(message || 'Something went wrong')\n } else if (logLevel === 'info') {\n if (message) {\n spinner.text = message\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n spinner.text = `🪂 Executing ${params?.hookName || 'unknown'}(${pc.yellow(params?.pluginName || 'unknown')})`\n }\n }\n }, 100)\n const logger: Logger = {\n log,\n spinner,\n }\n\n const onDone = async (hooks: KubbConfig['hooks'], logLevel: LogLevel) => {\n if (!hooks?.done) {\n return\n }\n\n let commands: string[] = []\n if (typeof hooks?.done === 'string') {\n commands = [hooks.done]\n } else {\n commands = hooks.done\n }\n\n const promises = commands.map(async (command) => {\n const oraWritable = new OraWritable(spinner, command)\n const [cmd, ..._args] = [...parseArgsStringToArgv(command)]\n spinner.start(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, { info: ` ${pc.dim(command)}` }, logLevel))\n\n const { stdout } = await execa(cmd, _args, {}).pipeStdout!(oraWritable)\n spinner.suffixText = ''\n oraWritable.destroy()\n // wait for 50ms to be sure\n await timeout(50)\n\n if (logLevel === 'info') {\n spinner.succeed(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, { info: ` ${pc.dim(command)}` }, logLevel))\n\n console.log(stdout)\n }\n })\n\n await Promise.all(promises)\n\n if (logLevel === 'silent') {\n spinner.succeed(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, {}, logLevel))\n }\n }\n\n const getSummary = (pluginManager: BuildOutput['pluginManager'], status: 'success' | 'failed'): string[] => {\n const logs: string[] = []\n const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart))\n\n const buildStartPlugins = [\n ...new Set(pluginManager.executed.filter((item) => item.hookName === 'buildStart' && item.plugin.name !== 'core').map((item) => item.plugin.name)),\n ]\n const pluginsCount = config.plugins?.length || 0\n const files = pluginManager.fileManager.files.sort((a, b) => {\n if (!a.meta?.pluginName || !b.meta?.pluginName) {\n return 0\n }\n if (a.meta?.pluginName.length < b.meta?.pluginName.length) {\n return 1\n }\n if (a.meta?.pluginName.length > b.meta?.pluginName.length) {\n return -1\n }\n return 0\n })\n\n const meta = {\n plugins:\n status === 'success'\n ? `${pc.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total`\n : `${pc.red(`${pluginsCount - buildStartPlugins.length + 1} failed`)}, ${pluginsCount} total`,\n filesCreated: files.length,\n time: pc.yellow(`${elapsedSeconds}s`),\n output: pathParser.resolve(config.root, config.output.path),\n } as const\n\n if (options.debug) {\n logs.push(pc.bold('Generated files:\\n'))\n logs.push(files.map((file) => `${pc.blue(file.meta?.pluginName)} ${file.path}`).join('\\n'))\n }\n\n logs.push(`\\n\n ${pc.bold('Plugins:')} ${meta.plugins}\n${pc.bold('Generated:')} ${meta.filesCreated} files\n ${pc.bold('Time:')} ${meta.time}\n ${pc.bold('Output:')} ${meta.output}\n \\n`)\n\n return logs\n }\n\n try {\n const { root, ...userConfig } = config\n const logLevel = options.logLevel ?? userConfig.logLevel ?? 'silent'\n const inputPath = options.input ?? userConfig.input.path\n\n spinner.start(parseText(`🚀 Building`, { info: `(${pc.dim(inputPath)})` }, logLevel))\n\n const output = await build({\n config: {\n root: process.cwd(),\n ...userConfig,\n logLevel,\n input: {\n ...userConfig.input,\n path: inputPath,\n },\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n spinner.succeed(parseText(`🚀 Build completed`, { info: `(${pc.dim(inputPath)})` }, logLevel))\n\n await onDone(config.hooks, logLevel)\n\n const summary = getSummary(output.pluginManager, 'success')\n console.log(summary.join(''))\n } catch (error: any) {\n if (error instanceof PluginError || error instanceof ParallelPluginError) {\n const summary = getSummary(error.pluginManager, 'failed')\n\n throw new SummaryError('Something went wrong\\n', { cause: error, summary })\n }\n\n throw new SummaryError('Something went wrong\\n', { cause: error })\n }\n}\n","export function parseHrtimeToSeconds(hrtime: [number, number]) {\n const seconds = (hrtime[0] + hrtime[1] / 1e9).toFixed(3)\n return seconds\n}\n","import type { LogLevel } from '@kubb/core'\n\nexport function parseText(baseText: string, config: Partial<Record<LogLevel, string>>, logLevel: LogLevel = 'silent') {\n return `${baseText}${config[logLevel] || ''}`\n}\n","import type { WritableOptions } from 'node:stream'\nimport { Writable } from 'node:stream'\nimport type { Ora } from 'ora'\nimport pc from 'picocolors'\n\nexport class OraWritable extends Writable {\n public command: string\n public spinner: Ora\n constructor(spinner: Ora, command: string, opts?: WritableOptions) {\n super(opts)\n\n this.command = command\n this.spinner = spinner\n }\n _write(chunk: any, _encoding: NodeJS.BufferEncoding, callback: (error?: Error | null) => void) {\n this.spinner.suffixText = `\\n\\n${pc.bold(pc.blue(this.command))}: ${chunk?.toString()}`\n\n callback()\n }\n}\n","import { isPromise } from '@kubb/core'\n\nimport { getPlugins } from './getPlugins.ts'\n\nimport type { CLIOptions, KubbConfig, KubbUserConfig } from '@kubb/core'\nimport type { CosmiconfigResult } from '../types.ts'\n\nexport async function getConfig(result: CosmiconfigResult, options: CLIOptions): Promise<KubbConfig> {\n const config = result?.config\n let kubbUserConfig: Promise<KubbUserConfig> = Promise.resolve(config) as Promise<KubbUserConfig>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(options)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as KubbConfig\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport mod from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst SLASHES = new Set(['/', '\\\\'])\n\n/**\n * Normalizes directories to have a trailing slash.\n * Resolve is pretty finicky -- if the directory name doesn't have\n * a trailing slash then it tries to look in the parent directory.\n * i.e., if the directory is \"/usr/nzakas/foo\" it will start the\n * search in /usr/nzakas. However, if the directory is \"/user/nzakas/foo/\",\n * then it will start the search in /user/nzakas/foo.\n * @param {string} directory The directory to check.\n * @returns {string} The normalized directory.\n */\nexport function normalizeDirectory(directory: string) {\n if (!SLASHES.has(directory[directory.length - 1])) {\n return `${directory}/`\n }\n\n return directory\n}\n\nexport async function importModule(path: string, cwd?: string): Promise<any> {\n let location = path\n\n if (cwd) {\n const require = mod.createRequire(normalizeDirectory(cwd))\n location = require.resolve(path)\n }\n\n const module = await import(pathToFileURL(location).href)\n\n return module?.default ?? module\n}\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n\nimport { importModule } from './importModule.ts'\n\nimport type { KubbJSONPlugin, KubbObjectPlugin, KubbUserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): plugins is KubbJSONPlugin[] {\n return !!(plugins as KubbJSONPlugin[])?.some((plugin) => {\n return typeof plugin?.[0] === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): plugins is KubbObjectPlugin {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nasync function importPlugin(name: string, options: object) {\n const importedPlugin = process.env.NODE_ENV === 'test' ? await import(name) : await importModule(name, process.cwd())\n\n return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options)\n}\n\nexport function getPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): Promise<KubbUserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n const promises = Object.keys(plugins).map(async (name) => {\n return importPlugin(name, plugins[name as keyof typeof plugins])\n })\n return Promise.all(promises)\n }\n\n if (isJSONPlugins(plugins)) {\n const promises = plugins.map(async (plugin) => {\n const [name, options = {}] = plugin\n return importPlugin(name, options)\n })\n return Promise.all(promises)\n }\n return Promise.resolve(plugins)\n}\n","import pc from 'picocolors'\n\nimport { spinner } from '../program'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>) {\n const { watch } = await import('chokidar')\n\n const ignored = ['**/{.git,node_modules}/**']\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n spinner.succeed(pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n // revert back\n spinner.spinner = 'clock'\n\n try {\n cb(path)\n } catch (e) {\n spinner.warn(pc.red('Watcher failed'))\n }\n })\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { cosmiconfig } from 'cosmiconfig'\nimport tsNode from 'ts-node'\nimport yaml from 'yaml'\n\nimport { importModule } from './importModule.ts'\n\nimport type { CosmiconfigResult } from '../types.ts'\n\nconst jsLoader = async (configFile: string) => {\n return importModule(configFile)\n}\n// TODO fix tsLoader for node 20 when using ESM only\n// https://github.com/TypeStrong/ts-node/issues/1997\nconst tsLoader = (configFile: string) => {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let registerer = { enabled() {} }\n\n try {\n // Register TypeScript compiler instance\n registerer = tsNode.register({\n compilerOptions: { module: 'commonjs' },\n swc: true,\n typeCheck: false,\n })\n\n const module = require(configFile)\n\n return module.default\n } catch (err: any) {\n if (err.code === 'MODULE_NOT_FOUND') {\n throw new Error(`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\\nError: ${err.message}`)\n }\n\n throw err\n } finally {\n registerer.enabled()\n }\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string) {\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.cjs`,\n `.${moduleName}rc.mjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.cjs`,\n `${moduleName}.config.mjs`,\n ],\n loaders: {\n '.yaml': (filepath, content) => yaml.parse(content),\n '.yml': (filepath, content) => yaml.parse(content),\n '.js': jsLoader,\n '.cjs': jsLoader,\n '.mjs': jsLoader,\n '.ts': tsLoader,\n noExt: jsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { ParallelPluginError } from '@kubb/core'\nimport PrettyError from 'pretty-error'\n\nexport const prettyError = new PrettyError()\n .skipPackage('commander')\n .skip(function (traceLine, lineNumber) {\n // exclude renderErrors.ts\n const pattern = new RegExp('renderErrors')\n\n const hasMatch = traceLine?.file?.match(pattern)\n\n if (typeof traceLine.packageName !== 'undefined' && hasMatch) {\n return true\n }\n } as PrettyError.Callback)\n .start()\n\nfunction getErrorCauses(errors: Error[]): string[] {\n return errors\n .reduce((prev, error) => {\n const causedError = error?.cause as Error\n if (causedError) {\n prev = [...prev, ...getErrorCauses([causedError])]\n }\n prev = [...prev, prettyError.render(error)]\n\n return prev\n }, [] as string[])\n .filter(Boolean)\n}\n\nexport function renderErrors(error: Error | undefined, { prefixText, debug = false }: { prefixText?: string; debug?: boolean }): string {\n if (!error) {\n return ''\n }\n\n if (error instanceof ParallelPluginError) {\n return [prefixText, ...error.errors.map((e) => renderErrors(e, { debug }))].filter(Boolean).join('\\n')\n }\n\n if (debug) {\n const errors = getErrorCauses([error])\n\n return [prefixText, ...errors].filter(Boolean).join('\\n')\n }\n\n // skip when no debug is set\n prettyError.skipNodeFiles()\n prettyError.skip(function () {\n return true\n } as PrettyError.Callback)\n\n return [prefixText, prettyError.render(error.message)].filter(Boolean).join('\\n')\n}\n","import type { Command } from 'commander'\n\nimport { program } from './program.ts'\n\nexport default function runCLI(argv?: readonly string[]): Command {\n return program.parse(argv)\n}\n"]}
|
package/dist/index.d.ts
CHANGED