@kubb/core 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OYDUQYAK.cjs → chunk-3J25BT5A.cjs} +15 -41
- package/dist/chunk-3J25BT5A.cjs.map +1 -0
- package/dist/{chunk-HI4PB2AG.js → chunk-DJBEBMX6.js} +10 -36
- package/dist/chunk-DJBEBMX6.js.map +1 -0
- package/dist/{chunk-JSJ3NRBQ.cjs → chunk-SSD2TXQZ.cjs} +51 -32
- package/dist/chunk-SSD2TXQZ.cjs.map +1 -0
- package/dist/{chunk-V6AVJEQC.js → chunk-W3NDP3K4.js} +52 -34
- package/dist/chunk-W3NDP3K4.js.map +1 -0
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -56
- package/dist/index.d.ts +54 -56
- package/dist/index.js +17 -18
- package/dist/index.js.map +1 -1
- package/dist/logger-wryz32Ex.d.cts +44 -0
- package/dist/logger-wryz32Ex.d.ts +44 -0
- package/dist/logger.cjs +5 -5
- package/dist/logger.d.cts +2 -32
- package/dist/logger.d.ts +2 -32
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +5 -11
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +5 -11
- package/dist/mocks.js.map +1 -1
- package/package.json +3 -3
- package/src/FileManager.ts +2 -2
- package/src/PluginManager.ts +39 -39
- package/src/build.ts +11 -13
- package/src/config.ts +5 -5
- package/src/index.ts +3 -15
- package/src/kubb.ts +11 -0
- package/src/logger.ts +37 -37
- package/src/plugin.ts +5 -5
- package/src/types.ts +23 -23
- package/dist/chunk-HI4PB2AG.js.map +0 -1
- package/dist/chunk-JSJ3NRBQ.cjs.map +0 -1
- package/dist/chunk-OYDUQYAK.cjs.map +0 -1
- package/dist/chunk-V6AVJEQC.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { writeLog } from './chunk-MYC5HIA5.js';
|
|
2
|
-
import { init_esm_shims } from './chunk-ETA3LCRB.js';
|
|
2
|
+
import { init_esm_shims, __privateAdd, __privateGet } from './chunk-ETA3LCRB.js';
|
|
3
3
|
import seedrandom from 'seedrandom';
|
|
4
4
|
import { isatty } from 'tty';
|
|
5
|
+
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
5
6
|
|
|
6
7
|
// src/logger.ts
|
|
7
8
|
init_esm_shims();
|
|
@@ -71,6 +72,29 @@ function w(r2 = false) {
|
|
|
71
72
|
}
|
|
72
73
|
var p2 = w(isatty(1));
|
|
73
74
|
|
|
75
|
+
// src/utils/EventEmitter.ts
|
|
76
|
+
init_esm_shims();
|
|
77
|
+
var _emitter;
|
|
78
|
+
var EventEmitter = class {
|
|
79
|
+
constructor() {
|
|
80
|
+
__privateAdd(this, _emitter, new EventEmitter$1());
|
|
81
|
+
__privateGet(this, _emitter).setMaxListeners(100);
|
|
82
|
+
}
|
|
83
|
+
emit(eventName, ...eventArg) {
|
|
84
|
+
__privateGet(this, _emitter).emit(eventName, ...eventArg);
|
|
85
|
+
}
|
|
86
|
+
on(eventName, handler) {
|
|
87
|
+
__privateGet(this, _emitter).on(eventName, handler);
|
|
88
|
+
}
|
|
89
|
+
off(eventName, handler) {
|
|
90
|
+
__privateGet(this, _emitter).off(eventName, handler);
|
|
91
|
+
}
|
|
92
|
+
removeAll() {
|
|
93
|
+
__privateGet(this, _emitter).removeAllListeners();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
_emitter = new WeakMap();
|
|
97
|
+
|
|
74
98
|
// src/logger.ts
|
|
75
99
|
var LogLevel = {
|
|
76
100
|
silent: "silent",
|
|
@@ -78,45 +102,39 @@ var LogLevel = {
|
|
|
78
102
|
debug: "debug"
|
|
79
103
|
};
|
|
80
104
|
function createLogger({ logLevel, name, spinner }) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
spinner.
|
|
85
|
-
logs.push(message);
|
|
105
|
+
const events = new EventEmitter();
|
|
106
|
+
events.on("start", (message) => {
|
|
107
|
+
if (spinner) {
|
|
108
|
+
spinner.start(message);
|
|
86
109
|
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
110
|
+
});
|
|
111
|
+
events.on("end", (message) => {
|
|
112
|
+
if (spinner) {
|
|
113
|
+
spinner.suffixText = "";
|
|
114
|
+
spinner.succeed(message);
|
|
91
115
|
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
if (
|
|
116
|
+
});
|
|
117
|
+
events.on("warning", (message) => {
|
|
118
|
+
if (spinner) {
|
|
95
119
|
spinner.warn(p2.yellow(message));
|
|
96
|
-
logs.push(message);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const info = (message) => {
|
|
100
|
-
if (message && spinner && logLevel !== LogLevel.silent) {
|
|
101
|
-
spinner.info(message);
|
|
102
|
-
logs.push(message);
|
|
103
120
|
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
});
|
|
122
|
+
events.on("error", (message) => {
|
|
123
|
+
throw new Error(message || "Something went wrong");
|
|
124
|
+
});
|
|
125
|
+
events.on("debug", async (messages) => {
|
|
126
|
+
await writeLog(messages.join("\n"));
|
|
127
|
+
});
|
|
110
128
|
const logger = {
|
|
111
129
|
name,
|
|
112
130
|
logLevel,
|
|
113
|
-
log,
|
|
114
|
-
error,
|
|
115
|
-
warn,
|
|
116
|
-
info,
|
|
117
|
-
debug,
|
|
118
131
|
spinner,
|
|
119
|
-
|
|
132
|
+
on: (...args) => {
|
|
133
|
+
return events.on(...args);
|
|
134
|
+
},
|
|
135
|
+
emit: (...args) => {
|
|
136
|
+
return events.emit(...args);
|
|
137
|
+
}
|
|
120
138
|
};
|
|
121
139
|
return logger;
|
|
122
140
|
}
|
|
@@ -147,6 +165,6 @@ function randomCliColour(text, colors = defaultColours) {
|
|
|
147
165
|
return formatter(text);
|
|
148
166
|
}
|
|
149
167
|
|
|
150
|
-
export { LogLevel, createLogger, p2 as p, randomCliColour, randomColour };
|
|
168
|
+
export { EventEmitter, LogLevel, createLogger, p2 as p, randomCliColour, randomColour };
|
|
151
169
|
//# sourceMappingURL=out.js.map
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-W3NDP3K4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js","../src/utils/EventEmitter.ts"],"names":["r","p"],"mappings":";;;;;;;;;;AAAA;AAAA,OAAO,gBAAgB;;;ACAvB;;;ACAA;AACA,IAAI,IAAI;AAAA,EACN,OAAO,CAAC,GAAG,CAAC;AAAA,EACZ,MAAM,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC/B,KAAK,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC9B,QAAQ,CAAC,GAAG,EAAE;AAAA,EACd,WAAW,CAAC,GAAG,EAAE;AAAA,EACjB,SAAS,CAAC,GAAG,EAAE;AAAA,EACf,QAAQ,CAAC,GAAG,EAAE;AAAA,EACd,eAAe,CAAC,GAAG,EAAE;AAAA,EACrB,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,KAAK,CAAC,IAAI,EAAE;AAAA,EACZ,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,QAAQ,CAAC,IAAI,EAAE;AAAA,EACf,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,SAAS,CAAC,IAAI,EAAE;AAAA,EAChB,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,MAAM,CAAC,IAAI,EAAE;AAAA,E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MAAM,MAAM;AACxC,QAAM,SAAS,OAAO,SAAS,MAAM;AACrC,QAAM,MAAM,OAAO,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACnD,QAAM,YAAuB,QAAQ,GAAG;AAExC,MAAI,QAAQ;AACV,WAAOA,GAAE,KAAK,UAAU,IAAI,CAAC;AAAA,EAC/B;AAEA,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO,UAAU,IAAI;AACvB","sourcesContent":["import seedrandom from 'seedrandom'\nimport c, { createColors } from 'tinyrainbow'\n\nimport { writeLog } from './fs/write.ts'\nimport { EventEmitter } from './utils/EventEmitter.ts'\n\nimport type { Ora } from 'ora'\nimport type { Formatter } from 'tinyrainbow'\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n\ntype Events = {\n start: [message: string]\n end: [message: string]\n error: [message: string]\n warning: [message: string]\n debug: [logs: string[]]\n}\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n\n spinner?: Ora\n on: EventEmitter<Events>['on']\n emit: EventEmitter<Events>['emit']\n}\n\ntype Props = {\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n}\n\nexport function createLogger({ logLevel, name, spinner }: Props): Logger {\n const events = new EventEmitter<Events>()\n\n events.on('start', (message) => {\n if (spinner) {\n spinner.start(message)\n }\n })\n\n events.on('end', (message) => {\n if (spinner) {\n spinner.suffixText = ''\n spinner.succeed(message)\n }\n })\n\n events.on('warning', (message) => {\n if (spinner) {\n spinner.warn(c.yellow(message))\n }\n })\n\n events.on('error', (message) => {\n throw new Error(message || 'Something went wrong')\n })\n\n events.on('debug', async (messages) => {\n await writeLog(messages.join('\\n'))\n })\n\n const logger: Logger = {\n name,\n logLevel,\n spinner,\n on: (...args) => {\n return events.on(...args)\n },\n emit: (...args) => {\n return events.emit(...args)\n },\n }\n\n return logger\n}\n\nconst defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomCliColour(text?: string, colors = defaultColours): string {\n const colours = createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return c.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import {\n a as t,\n b as e,\n c as o\n} from \"./chunk-5WCZOS7T.js\";\n\n// src/node.ts\nimport { isatty as r } from \"tty\";\nvar p = o(r(1));\nexport {\n o as createColors,\n p as default,\n t as getDefaultColors,\n e as isSupported\n};\n","// src/index.ts\nvar b = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49]\n}, C = Object.entries(b);\nfunction d(r) {\n return String(r);\n}\nd.open = \"\";\nd.close = \"\";\nvar m = /* @__PURE__ */ C.reduce(\n (r, [n]) => (r[n] = d, r),\n { isColorSupported: !1 }\n);\nfunction x() {\n return { ...m };\n}\nfunction p(r = !1) {\n let n = typeof process != \"undefined\" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];\n 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\" || r && t.TERM !== \"dumb\" || \"CI\" in t) || typeof window != \"undefined\" && !!window.chrome;\n}\nfunction w(r = !1) {\n let n = p(r), t = (e, o, c, i) => {\n let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);\n return ~l ? u + t(s, o, c, l) : u + s;\n }, a = (e, o, c = e) => {\n let i = (u) => {\n let s = String(u), l = s.indexOf(o, e.length);\n return ~l ? e + t(s, o, c, l) + o : e + s + o;\n };\n return i.open = e, i.close = o, i;\n }, g = {\n isColorSupported: n\n }, f = (e) => `\\x1B[${e}m`;\n for (let [e, o] of C)\n g[e] = n ? a(\n f(o[0]),\n f(o[1]),\n o[2]\n ) : d;\n return g;\n}\n\nexport {\n x as a,\n p as b,\n w as c\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport { EventEmitter as NodeEventEmitter } from 'node:events'\n\nexport class EventEmitter<TEvents extends Record<string, any>> {\n constructor() {\n this.#emitter.setMaxListeners(100)\n }\n #emitter = new NodeEventEmitter()\n\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {\n this.#emitter.emit(eventName, ...(eventArg as []))\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.on(eventName, handler as any)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.off(eventName, handler as any)\n }\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var chunkLDKM6T7X_cjs = require('./chunk-LDKM6T7X.cjs');
|
|
6
6
|
var chunk5SUBV3F7_cjs = require('./chunk-5SUBV3F7.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunk3J25BT5A_cjs = require('./chunk-3J25BT5A.cjs');
|
|
8
8
|
require('./chunk-2UXXYHS6.cjs');
|
|
9
9
|
require('./chunk-KXP7HD6Z.cjs');
|
|
10
10
|
require('./chunk-N7XIQXXQ.cjs');
|
|
11
|
-
var
|
|
11
|
+
var chunkSSD2TXQZ_cjs = require('./chunk-SSD2TXQZ.cjs');
|
|
12
12
|
var chunkXX56SVPB_cjs = require('./chunk-XX56SVPB.cjs');
|
|
13
13
|
require('./chunk-DM53DOLW.cjs');
|
|
14
14
|
var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
|
|
@@ -48,7 +48,7 @@ async function transformReducer(_previousCode, result, _plugin) {
|
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
50
|
async function setup(options) {
|
|
51
|
-
const { config, logger =
|
|
51
|
+
const { config, logger = chunkSSD2TXQZ_cjs.createLogger({ logLevel: chunkSSD2TXQZ_cjs.LogLevel.silent }) } = options;
|
|
52
52
|
let count = 0;
|
|
53
53
|
try {
|
|
54
54
|
if (isInputPath(config) && !new chunkLDKM6T7X_cjs.URLPath(config.input.path).isURL) {
|
|
@@ -57,7 +57,7 @@ async function setup(options) {
|
|
|
57
57
|
} catch (e) {
|
|
58
58
|
if (isInputPath(config)) {
|
|
59
59
|
throw new Error(
|
|
60
|
-
"Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " +
|
|
60
|
+
"Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + chunkSSD2TXQZ_cjs.p.dim(config.input.path),
|
|
61
61
|
{
|
|
62
62
|
cause: e
|
|
63
63
|
}
|
|
@@ -69,15 +69,15 @@ async function setup(options) {
|
|
|
69
69
|
}
|
|
70
70
|
const task = async (file) => {
|
|
71
71
|
const { path: path3 } = file;
|
|
72
|
-
let source =
|
|
72
|
+
let source = chunk3J25BT5A_cjs.FileManager.getSource(file);
|
|
73
73
|
const { result: loadedResult } = await pluginManager.hookFirst({
|
|
74
74
|
hookName: "load",
|
|
75
75
|
parameters: [path3]
|
|
76
76
|
});
|
|
77
|
-
if (loadedResult &&
|
|
77
|
+
if (loadedResult && chunk3J25BT5A_cjs.isPromise(loadedResult)) {
|
|
78
78
|
source = await loadedResult;
|
|
79
79
|
}
|
|
80
|
-
if (loadedResult && !
|
|
80
|
+
if (loadedResult && !chunk3J25BT5A_cjs.isPromise(loadedResult)) {
|
|
81
81
|
source = loadedResult;
|
|
82
82
|
}
|
|
83
83
|
if (source) {
|
|
@@ -105,57 +105,57 @@ async function setup(options) {
|
|
|
105
105
|
source: source || ""
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
-
const pluginManager = new
|
|
108
|
+
const pluginManager = new chunk3J25BT5A_cjs.PluginManager(config, { logger, task });
|
|
109
109
|
pluginManager.on("execute", (executer) => {
|
|
110
110
|
const { hookName, parameters, plugin } = executer;
|
|
111
|
-
if (hookName === "writeFile"
|
|
111
|
+
if (hookName === "writeFile") {
|
|
112
112
|
const [code] = parameters;
|
|
113
|
-
if (logger.logLevel ===
|
|
114
|
-
logger.debug
|
|
113
|
+
if (logger.logLevel === chunkSSD2TXQZ_cjs.LogLevel.debug) {
|
|
114
|
+
logger.emit("debug", [`PluginKey ${chunkSSD2TXQZ_cjs.p.dim(JSON.stringify(plugin.key))}
|
|
115
115
|
with source
|
|
116
116
|
|
|
117
|
-
${code}`);
|
|
117
|
+
${code}`]);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
pluginManager.queue.on("add", () => {
|
|
122
|
-
if (logger.logLevel !==
|
|
122
|
+
if (logger.logLevel !== chunkSSD2TXQZ_cjs.LogLevel.info) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
logger.
|
|
125
|
+
if (count === 0) {
|
|
126
|
+
logger.emit("start", `\u{1F4BE} Writing`);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
pluginManager.queue.on("active", () => {
|
|
130
|
-
if (logger.logLevel !==
|
|
130
|
+
if (logger.logLevel !== chunkSSD2TXQZ_cjs.LogLevel.info) {
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
if (logger.spinner && pluginManager.queue.size > 0) {
|
|
134
134
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
135
|
-
logger.spinner.suffixText =
|
|
135
|
+
logger.spinner.suffixText = chunkSSD2TXQZ_cjs.p.dim(text);
|
|
136
136
|
}
|
|
137
137
|
++count;
|
|
138
138
|
});
|
|
139
139
|
pluginManager.queue.on("completed", () => {
|
|
140
|
-
if (logger.logLevel !==
|
|
140
|
+
if (logger.logLevel !== chunkSSD2TXQZ_cjs.LogLevel.info) {
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
if (logger.spinner) {
|
|
144
144
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
145
|
-
logger.spinner.suffixText =
|
|
145
|
+
logger.spinner.suffixText = chunkSSD2TXQZ_cjs.p.dim(text);
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
pluginManager.on("executed", (executer) => {
|
|
149
149
|
const { hookName, plugin, output, parameters } = executer;
|
|
150
|
-
if (logger.logLevel ===
|
|
150
|
+
if (logger.logLevel === chunkSSD2TXQZ_cjs.LogLevel.debug) {
|
|
151
151
|
const logs = [
|
|
152
|
-
`${
|
|
153
|
-
parameters && `${
|
|
152
|
+
`${chunkSSD2TXQZ_cjs.randomCliColour(plugin.name)} Executing ${hookName}`,
|
|
153
|
+
parameters && `${chunkSSD2TXQZ_cjs.p.bgWhite(`Parameters`)} ${chunkSSD2TXQZ_cjs.randomCliColour(plugin.name)} ${hookName}`,
|
|
154
154
|
JSON.stringify(parameters, void 0, 2),
|
|
155
|
-
output && `${
|
|
155
|
+
output && `${chunkSSD2TXQZ_cjs.p.bgWhite("Output")} ${chunkSSD2TXQZ_cjs.randomCliColour(plugin.name)} ${hookName}`,
|
|
156
156
|
output
|
|
157
157
|
].filter(Boolean);
|
|
158
|
-
logger.
|
|
158
|
+
logger.emit("debug", logs);
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
return pluginManager;
|
|
@@ -168,11 +168,10 @@ async function build(options) {
|
|
|
168
168
|
parameters: [options.config]
|
|
169
169
|
});
|
|
170
170
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
171
|
-
if (logger.logLevel ===
|
|
172
|
-
logger.
|
|
173
|
-
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
171
|
+
if (logger.logLevel === chunkSSD2TXQZ_cjs.LogLevel.info) {
|
|
172
|
+
logger.emit("end", `\u{1F4BE} Writing completed`);
|
|
174
173
|
}
|
|
175
|
-
return { files: fileManager.files.map((file) => ({ ...file, source:
|
|
174
|
+
return { files: fileManager.files.map((file) => ({ ...file, source: chunk3J25BT5A_cjs.FileManager.getSource(file) })), pluginManager };
|
|
176
175
|
}
|
|
177
176
|
async function safeBuild(options) {
|
|
178
177
|
const pluginManager = await setup(options);
|
|
@@ -183,14 +182,13 @@ async function safeBuild(options) {
|
|
|
183
182
|
parameters: [options.config]
|
|
184
183
|
});
|
|
185
184
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
186
|
-
if (logger.logLevel ===
|
|
187
|
-
logger.
|
|
188
|
-
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
185
|
+
if (logger.logLevel === chunkSSD2TXQZ_cjs.LogLevel.info) {
|
|
186
|
+
logger.emit("end", `\u{1F4BE} Writing completed`);
|
|
189
187
|
}
|
|
190
188
|
} catch (e) {
|
|
191
|
-
return { files: fileManager.files.map((file) => ({ ...file, source:
|
|
189
|
+
return { files: fileManager.files.map((file) => ({ ...file, source: chunk3J25BT5A_cjs.FileManager.getSource(file) })), pluginManager, error: e };
|
|
192
190
|
}
|
|
193
|
-
return { files: fileManager.files.map((file) => ({ ...file, source:
|
|
191
|
+
return { files: fileManager.files.map((file) => ({ ...file, source: chunk3J25BT5A_cjs.FileManager.getSource(file) })), pluginManager };
|
|
194
192
|
}
|
|
195
193
|
|
|
196
194
|
// src/Generator.ts
|
|
@@ -646,45 +644,47 @@ match_fn = function(packageJSON, dependency) {
|
|
|
646
644
|
chunkKAA3L7N6_cjs.__privateAdd(_PackageManager, _cache, {});
|
|
647
645
|
var PackageManager = _PackageManager;
|
|
648
646
|
|
|
649
|
-
// src/
|
|
650
|
-
var
|
|
647
|
+
// src/kubb.ts
|
|
648
|
+
var kubb_exports = {};
|
|
649
|
+
chunkKAA3L7N6_cjs.init_cjs_shims();
|
|
651
650
|
|
|
652
651
|
Object.defineProperty(exports, "FileManager", {
|
|
653
652
|
enumerable: true,
|
|
654
|
-
get: function () { return
|
|
653
|
+
get: function () { return chunk3J25BT5A_cjs.FileManager; }
|
|
655
654
|
});
|
|
656
655
|
Object.defineProperty(exports, "KubbFile", {
|
|
657
656
|
enumerable: true,
|
|
658
|
-
get: function () { return
|
|
657
|
+
get: function () { return chunk3J25BT5A_cjs.KubbFile; }
|
|
659
658
|
});
|
|
660
659
|
Object.defineProperty(exports, "PluginManager", {
|
|
661
660
|
enumerable: true,
|
|
662
|
-
get: function () { return
|
|
661
|
+
get: function () { return chunk3J25BT5A_cjs.PluginManager; }
|
|
663
662
|
});
|
|
664
663
|
Object.defineProperty(exports, "PromiseManager", {
|
|
665
664
|
enumerable: true,
|
|
666
|
-
get: function () { return
|
|
665
|
+
get: function () { return chunk3J25BT5A_cjs.PromiseManager; }
|
|
667
666
|
});
|
|
668
667
|
Object.defineProperty(exports, "Warning", {
|
|
669
668
|
enumerable: true,
|
|
670
|
-
get: function () { return
|
|
669
|
+
get: function () { return chunk3J25BT5A_cjs.Warning; }
|
|
671
670
|
});
|
|
672
671
|
Object.defineProperty(exports, "createPlugin", {
|
|
673
672
|
enumerable: true,
|
|
674
|
-
get: function () { return
|
|
673
|
+
get: function () { return chunk3J25BT5A_cjs.createPlugin; }
|
|
675
674
|
});
|
|
676
675
|
Object.defineProperty(exports, "name", {
|
|
677
676
|
enumerable: true,
|
|
678
|
-
get: function () { return
|
|
677
|
+
get: function () { return chunk3J25BT5A_cjs.pluginName; }
|
|
679
678
|
});
|
|
680
679
|
Object.defineProperty(exports, "pluginName", {
|
|
681
680
|
enumerable: true,
|
|
682
|
-
get: function () { return
|
|
681
|
+
get: function () { return chunk3J25BT5A_cjs.pluginName; }
|
|
683
682
|
});
|
|
684
683
|
exports.Generator = Generator;
|
|
684
|
+
exports.Kubb = kubb_exports;
|
|
685
685
|
exports.PackageManager = PackageManager;
|
|
686
686
|
exports.build = build;
|
|
687
|
-
exports.default =
|
|
687
|
+
exports.default = build;
|
|
688
688
|
exports.defineConfig = defineConfig;
|
|
689
689
|
exports.isInputPath = isInputPath;
|
|
690
690
|
exports.safeBuild = safeBuild;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.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oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AJQP,IAAO,cAAQ","sourcesContent":["import { build } from './build.ts'\n\nimport type { ObjValueTuple, TupleToUnion } from '@kubb/types'\n\nexport { build, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type * from './types.ts'\n\nexport interface _Register {}\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n\nexport default build\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { KubbPlugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: KubbPlugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile' && logger.spinner) {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.debug(`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`)\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && count === 0) {\n logger.spinner?.start(`💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.debug(logs.join('\\n'))\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, InputPath, KubbConfig, KubbUserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link KubbConfig} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/kubb.ts"],"names":["path","fileURLToPath","toPath","fs","fsPromises","require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,S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EA,QAAI,mBAAmB,SAAS;AAC9B,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AAAA,EACA,YAAY,YAAqC,SAAqC;AACpF,UAAM,iBAAiB,KAAK,eAAe,UAAU;AAErD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AQlBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type { CLIOptions, Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams, UserConfig } from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
|