@kubb/agent 5.0.0-alpha.42 → 5.0.0-alpha.44
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +297 -736
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +0 -1
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +0 -1
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -1
- package/.output/server/node_modules/jiti/lib/jiti.mjs +9 -2
- package/.output/server/node_modules/jiti/package.json +29 -30
- package/.output/server/package.json +2 -2
- package/package.json +6 -6
- package/.output/server/node_modules/jiti/dist/babel.cjs +0 -246
|
@@ -7,14 +7,13 @@ import https, { Server } from 'node:https';
|
|
|
7
7
|
import { EventEmitter } from 'node:events';
|
|
8
8
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
9
9
|
import { promises, existsSync } from 'node:fs';
|
|
10
|
-
import path$1, { resolve, dirname, relative, join, extname,
|
|
10
|
+
import path$1, { resolve, dirname, relative, join, extname, posix } from 'node:path';
|
|
11
11
|
import anymatch from 'anymatch';
|
|
12
12
|
import { createHash, randomBytes } from 'node:crypto';
|
|
13
13
|
import process$1, { version as version$2 } from 'node:process';
|
|
14
14
|
import { spawn } from 'node:child_process';
|
|
15
15
|
import { Logtail } from '@logtail/node';
|
|
16
16
|
import { consola } from 'consola';
|
|
17
|
-
import { performance } from 'node:perf_hooks';
|
|
18
17
|
import { deflateSync } from 'fflate';
|
|
19
18
|
import { x } from 'tinyexec';
|
|
20
19
|
import { access, rm, readFile as readFile$1, readdir as readdir$1, mkdir, writeFile as writeFile$1 } from 'node:fs/promises';
|
|
@@ -4438,6 +4437,36 @@ const logger = {
|
|
|
4438
4437
|
const _KZ9YuROWp70nNn4X1C4BxF_W0D7H9EWgBo03XvMd7w0 = defineNitroPlugin(() => {
|
|
4439
4438
|
});
|
|
4440
4439
|
|
|
4440
|
+
function formatMs$1(ms) {
|
|
4441
|
+
if (ms >= 6e4) return `${Math.floor(ms / 6e4)}m ${(ms % 6e4 / 1e3).toFixed(1)}s`;
|
|
4442
|
+
if (ms >= 1e3) return `${(ms / 1e3).toFixed(2)}s`;
|
|
4443
|
+
return `${Math.round(ms)}ms`;
|
|
4444
|
+
}
|
|
4445
|
+
function parseHex(color) {
|
|
4446
|
+
const int = Number.parseInt(color.replace("#", ""), 16);
|
|
4447
|
+
return Number.isNaN(int) ? {
|
|
4448
|
+
r: 255,
|
|
4449
|
+
g: 255,
|
|
4450
|
+
b: 255
|
|
4451
|
+
} : {
|
|
4452
|
+
r: int >> 16 & 255,
|
|
4453
|
+
g: int >> 8 & 255,
|
|
4454
|
+
b: int & 255
|
|
4455
|
+
};
|
|
4456
|
+
}
|
|
4457
|
+
function hex(color) {
|
|
4458
|
+
const { r, g, b } = parseHex(color);
|
|
4459
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[0m`;
|
|
4460
|
+
}
|
|
4461
|
+
({
|
|
4462
|
+
lid: hex("#F55A17"),
|
|
4463
|
+
woodTop: hex("#F5A217"),
|
|
4464
|
+
woodMid: hex("#F58517"),
|
|
4465
|
+
woodBase: hex("#B45309"),
|
|
4466
|
+
eye: hex("#FFFFFF"),
|
|
4467
|
+
highlight: hex("#adadc6"),
|
|
4468
|
+
blush: hex("#FDA4AF")
|
|
4469
|
+
});
|
|
4441
4470
|
const formatters = {
|
|
4442
4471
|
prettier: {
|
|
4443
4472
|
command: "prettier",
|
|
@@ -4516,36 +4545,6 @@ async function detectLinter() {
|
|
|
4516
4545
|
for (const linter of linterNames) if (await isLinterAvailable(linter)) return linter;
|
|
4517
4546
|
return null;
|
|
4518
4547
|
}
|
|
4519
|
-
function formatMs$1(ms) {
|
|
4520
|
-
if (ms >= 6e4) return `${Math.floor(ms / 6e4)}m ${(ms % 6e4 / 1e3).toFixed(1)}s`;
|
|
4521
|
-
if (ms >= 1e3) return `${(ms / 1e3).toFixed(2)}s`;
|
|
4522
|
-
return `${Math.round(ms)}ms`;
|
|
4523
|
-
}
|
|
4524
|
-
function parseHex(color) {
|
|
4525
|
-
const int = Number.parseInt(color.replace("#", ""), 16);
|
|
4526
|
-
return Number.isNaN(int) ? {
|
|
4527
|
-
r: 255,
|
|
4528
|
-
g: 255,
|
|
4529
|
-
b: 255
|
|
4530
|
-
} : {
|
|
4531
|
-
r: int >> 16 & 255,
|
|
4532
|
-
g: int >> 8 & 255,
|
|
4533
|
-
b: int & 255
|
|
4534
|
-
};
|
|
4535
|
-
}
|
|
4536
|
-
function hex(color) {
|
|
4537
|
-
const { r, g, b } = parseHex(color);
|
|
4538
|
-
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[0m`;
|
|
4539
|
-
}
|
|
4540
|
-
({
|
|
4541
|
-
lid: hex("#F55A17"),
|
|
4542
|
-
woodTop: hex("#F5A217"),
|
|
4543
|
-
woodMid: hex("#F58517"),
|
|
4544
|
-
woodBase: hex("#B45309"),
|
|
4545
|
-
eye: hex("#FFFFFF"),
|
|
4546
|
-
highlight: hex("#adadc6"),
|
|
4547
|
-
blush: hex("#FDA4AF")
|
|
4548
|
-
});
|
|
4549
4548
|
function serializePluginOptions(options) {
|
|
4550
4549
|
if (options === null || options === void 0) return {};
|
|
4551
4550
|
if (typeof options !== "object") return options;
|
|
@@ -4702,18 +4701,22 @@ function combineExports(exports$1) {
|
|
|
4702
4701
|
const result = [];
|
|
4703
4702
|
const namedByPath = /* @__PURE__ */ new Map();
|
|
4704
4703
|
const seen = /* @__PURE__ */ new Set();
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4704
|
+
const keyed = exports$1.map((node) => ({
|
|
4705
|
+
node,
|
|
4706
|
+
key: sortKey(node)
|
|
4707
|
+
}));
|
|
4708
|
+
keyed.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
|
|
4709
|
+
for (const { node: curr } of keyed) {
|
|
4710
4710
|
const { name, path: path2, isTypeOnly, asAlias } = curr;
|
|
4711
4711
|
if (Array.isArray(name)) {
|
|
4712
4712
|
if (!name.length) continue;
|
|
4713
4713
|
const key = pathTypeKey(path2, isTypeOnly);
|
|
4714
4714
|
const existing = namedByPath.get(key);
|
|
4715
|
-
if (existing && Array.isArray(existing.name))
|
|
4716
|
-
|
|
4715
|
+
if (existing && Array.isArray(existing.name)) {
|
|
4716
|
+
const merged = new Set(existing.name);
|
|
4717
|
+
for (const n of name) merged.add(n);
|
|
4718
|
+
existing.name = [...merged];
|
|
4719
|
+
} else {
|
|
4717
4720
|
const newItem = {
|
|
4718
4721
|
...curr,
|
|
4719
4722
|
name: [...new Set(name)]
|
|
@@ -4737,11 +4740,12 @@ function combineImports(imports, exports$1, source) {
|
|
|
4737
4740
|
const result = [];
|
|
4738
4741
|
const namedByPath = /* @__PURE__ */ new Map();
|
|
4739
4742
|
const seen = /* @__PURE__ */ new Set();
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4743
|
+
const keyed = imports.map((node) => ({
|
|
4744
|
+
node,
|
|
4745
|
+
key: sortKey(node)
|
|
4746
|
+
}));
|
|
4747
|
+
keyed.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
|
|
4748
|
+
for (const { node: curr } of keyed) {
|
|
4745
4749
|
if (curr.path === curr.root) continue;
|
|
4746
4750
|
const { path: path2, isTypeOnly } = curr;
|
|
4747
4751
|
let { name } = curr;
|
|
@@ -4750,8 +4754,11 @@ function combineImports(imports, exports$1, source) {
|
|
|
4750
4754
|
if (!name.length) continue;
|
|
4751
4755
|
const key = pathTypeKey(path2, isTypeOnly);
|
|
4752
4756
|
const existing = namedByPath.get(key);
|
|
4753
|
-
if (existing && Array.isArray(existing.name))
|
|
4754
|
-
|
|
4757
|
+
if (existing && Array.isArray(existing.name)) {
|
|
4758
|
+
const merged = new Set(existing.name);
|
|
4759
|
+
for (const n of name) merged.add(n);
|
|
4760
|
+
existing.name = [...merged];
|
|
4761
|
+
} else {
|
|
4755
4762
|
const newItem = {
|
|
4756
4763
|
...curr,
|
|
4757
4764
|
name
|
|
@@ -5084,15 +5091,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
5084
5091
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
5085
5092
|
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
5086
5093
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
5087
|
-
var
|
|
5088
|
-
set _(value) {
|
|
5089
|
-
__privateSet$1(obj, member, value);
|
|
5090
|
-
},
|
|
5091
|
-
get _() {
|
|
5092
|
-
return __privateGet$1(obj, member, getter);
|
|
5093
|
-
}
|
|
5094
|
-
});
|
|
5095
|
-
var _a$1, _head, _tail, _size, _b$1, _cache, _filesCache, _c$1, _studioIsOpen, _pluginsWithEventGenerators, _resolvers, _defaultResolvers, _hookListeners, _PluginDriver_instances, normalizeHookStylePlugin_fn, trackHookListener_fn, createDefaultResolver_fn, emitProcessingEnd_fn, execute_fn, executeSync_fn, _d$1;
|
|
5094
|
+
var _cache, _filesCache, _a$1, _studioIsOpen, _pluginsWithEventGenerators, _resolvers, _defaultResolvers, _hookListeners, _PluginDriver_instances, normalizePlugin_fn, trackHookListener_fn, createDefaultResolver_fn, _b$1;
|
|
5096
5095
|
function toCamelOrPascal(text, pascal) {
|
|
5097
5096
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
5098
5097
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
@@ -5118,254 +5117,41 @@ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
|
5118
5117
|
}) : camelCase(part));
|
|
5119
5118
|
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
|
|
5120
5119
|
}
|
|
5121
|
-
function isPromiseRejectedResult(result) {
|
|
5122
|
-
return result.status === "rejected";
|
|
5123
|
-
}
|
|
5124
|
-
const reservedWords = /* @__PURE__ */ new Set([
|
|
5125
|
-
"abstract",
|
|
5126
|
-
"arguments",
|
|
5127
|
-
"boolean",
|
|
5128
|
-
"break",
|
|
5129
|
-
"byte",
|
|
5130
|
-
"case",
|
|
5131
|
-
"catch",
|
|
5132
|
-
"char",
|
|
5133
|
-
"class",
|
|
5134
|
-
"const",
|
|
5135
|
-
"continue",
|
|
5136
|
-
"debugger",
|
|
5137
|
-
"default",
|
|
5138
|
-
"delete",
|
|
5139
|
-
"do",
|
|
5140
|
-
"double",
|
|
5141
|
-
"else",
|
|
5142
|
-
"enum",
|
|
5143
|
-
"eval",
|
|
5144
|
-
"export",
|
|
5145
|
-
"extends",
|
|
5146
|
-
"false",
|
|
5147
|
-
"final",
|
|
5148
|
-
"finally",
|
|
5149
|
-
"float",
|
|
5150
|
-
"for",
|
|
5151
|
-
"function",
|
|
5152
|
-
"goto",
|
|
5153
|
-
"if",
|
|
5154
|
-
"implements",
|
|
5155
|
-
"import",
|
|
5156
|
-
"in",
|
|
5157
|
-
"instanceof",
|
|
5158
|
-
"int",
|
|
5159
|
-
"interface",
|
|
5160
|
-
"let",
|
|
5161
|
-
"long",
|
|
5162
|
-
"native",
|
|
5163
|
-
"new",
|
|
5164
|
-
"null",
|
|
5165
|
-
"package",
|
|
5166
|
-
"private",
|
|
5167
|
-
"protected",
|
|
5168
|
-
"public",
|
|
5169
|
-
"return",
|
|
5170
|
-
"short",
|
|
5171
|
-
"static",
|
|
5172
|
-
"super",
|
|
5173
|
-
"switch",
|
|
5174
|
-
"synchronized",
|
|
5175
|
-
"this",
|
|
5176
|
-
"throw",
|
|
5177
|
-
"throws",
|
|
5178
|
-
"transient",
|
|
5179
|
-
"true",
|
|
5180
|
-
"try",
|
|
5181
|
-
"typeof",
|
|
5182
|
-
"var",
|
|
5183
|
-
"void",
|
|
5184
|
-
"volatile",
|
|
5185
|
-
"while",
|
|
5186
|
-
"with",
|
|
5187
|
-
"yield",
|
|
5188
|
-
"Array",
|
|
5189
|
-
"Date",
|
|
5190
|
-
"hasOwnProperty",
|
|
5191
|
-
"Infinity",
|
|
5192
|
-
"isFinite",
|
|
5193
|
-
"isNaN",
|
|
5194
|
-
"isPrototypeOf",
|
|
5195
|
-
"length",
|
|
5196
|
-
"Math",
|
|
5197
|
-
"name",
|
|
5198
|
-
"NaN",
|
|
5199
|
-
"Number",
|
|
5200
|
-
"Object",
|
|
5201
|
-
"prototype",
|
|
5202
|
-
"String",
|
|
5203
|
-
"toString",
|
|
5204
|
-
"undefined",
|
|
5205
|
-
"valueOf"
|
|
5206
|
-
]);
|
|
5207
|
-
function transformReservedWord(word) {
|
|
5208
|
-
const firstChar = word.charCodeAt(0);
|
|
5209
|
-
if (word && (reservedWords.has(word) || firstChar >= 48 && firstChar <= 57)) return `_${word}`;
|
|
5210
|
-
return word;
|
|
5211
|
-
}
|
|
5212
|
-
function isValidVarName(name) {
|
|
5213
|
-
try {
|
|
5214
|
-
new Function(`var ${name}`);
|
|
5215
|
-
} catch {
|
|
5216
|
-
return false;
|
|
5217
|
-
}
|
|
5218
|
-
return true;
|
|
5219
|
-
}
|
|
5220
5120
|
function trimExtName$1(text) {
|
|
5221
5121
|
const dotIndex = text.lastIndexOf(".");
|
|
5222
5122
|
if (dotIndex > 0 && !text.includes("/", dotIndex)) return text.slice(0, dotIndex);
|
|
5223
5123
|
return text;
|
|
5224
5124
|
}
|
|
5225
5125
|
const DEFAULT_STUDIO_URL = "https://studio.kubb.dev";
|
|
5226
|
-
const
|
|
5126
|
+
const BARREL_BASENAME = "index";
|
|
5127
|
+
const BARREL_FILENAME = `${BARREL_BASENAME}.ts`;
|
|
5227
5128
|
const DEFAULT_BANNER = "simple";
|
|
5228
5129
|
const DEFAULT_EXTENSION = { ".ts": ".ts" };
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
var Queue = (_b$1 = class {
|
|
5237
|
-
constructor() {
|
|
5238
|
-
__privateAdd$1(this, _head);
|
|
5239
|
-
__privateAdd$1(this, _tail);
|
|
5240
|
-
__privateAdd$1(this, _size);
|
|
5241
|
-
this.clear();
|
|
5242
|
-
}
|
|
5243
|
-
enqueue(value) {
|
|
5244
|
-
const node = new Node$1(value);
|
|
5245
|
-
if (__privateGet$1(this, _head)) {
|
|
5246
|
-
__privateGet$1(this, _tail).next = node;
|
|
5247
|
-
__privateSet$1(this, _tail, node);
|
|
5248
|
-
} else {
|
|
5249
|
-
__privateSet$1(this, _head, node);
|
|
5250
|
-
__privateSet$1(this, _tail, node);
|
|
5251
|
-
}
|
|
5252
|
-
__privateWrapper(this, _size)._++;
|
|
5253
|
-
}
|
|
5254
|
-
dequeue() {
|
|
5255
|
-
const current = __privateGet$1(this, _head);
|
|
5256
|
-
if (!current) return;
|
|
5257
|
-
__privateSet$1(this, _head, __privateGet$1(this, _head).next);
|
|
5258
|
-
__privateWrapper(this, _size)._--;
|
|
5259
|
-
if (!__privateGet$1(this, _head)) __privateSet$1(this, _tail, void 0);
|
|
5260
|
-
return current.value;
|
|
5261
|
-
}
|
|
5262
|
-
peek() {
|
|
5263
|
-
if (!__privateGet$1(this, _head)) return;
|
|
5264
|
-
return __privateGet$1(this, _head).value;
|
|
5265
|
-
}
|
|
5266
|
-
clear() {
|
|
5267
|
-
__privateSet$1(this, _head, void 0);
|
|
5268
|
-
__privateSet$1(this, _tail, void 0);
|
|
5269
|
-
__privateSet$1(this, _size, 0);
|
|
5270
|
-
}
|
|
5271
|
-
get size() {
|
|
5272
|
-
return __privateGet$1(this, _size);
|
|
5273
|
-
}
|
|
5274
|
-
*[Symbol.iterator]() {
|
|
5275
|
-
let current = __privateGet$1(this, _head);
|
|
5276
|
-
while (current) {
|
|
5277
|
-
yield current.value;
|
|
5278
|
-
current = current.next;
|
|
5130
|
+
const stringPatternCache = /* @__PURE__ */ new Map();
|
|
5131
|
+
function testPattern(value, pattern) {
|
|
5132
|
+
if (typeof pattern === "string") {
|
|
5133
|
+
let regex = stringPatternCache.get(pattern);
|
|
5134
|
+
if (!regex) {
|
|
5135
|
+
regex = new RegExp(pattern);
|
|
5136
|
+
stringPatternCache.set(pattern, regex);
|
|
5279
5137
|
}
|
|
5138
|
+
return regex.test(value);
|
|
5280
5139
|
}
|
|
5281
|
-
|
|
5282
|
-
while (__privateGet$1(this, _head)) yield this.dequeue();
|
|
5283
|
-
}
|
|
5284
|
-
}, _head = new WeakMap(), _tail = new WeakMap(), _size = new WeakMap(), _b$1);
|
|
5285
|
-
function pLimit(concurrency) {
|
|
5286
|
-
let rejectOnClear = false;
|
|
5287
|
-
if (typeof concurrency === "object") ({ concurrency, rejectOnClear = false } = concurrency);
|
|
5288
|
-
validateConcurrency(concurrency);
|
|
5289
|
-
if (typeof rejectOnClear !== "boolean") throw new TypeError("Expected `rejectOnClear` to be a boolean");
|
|
5290
|
-
const queue = new Queue();
|
|
5291
|
-
let activeCount = 0;
|
|
5292
|
-
const resumeNext = () => {
|
|
5293
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
5294
|
-
activeCount++;
|
|
5295
|
-
queue.dequeue().run();
|
|
5296
|
-
}
|
|
5297
|
-
};
|
|
5298
|
-
const next = () => {
|
|
5299
|
-
activeCount--;
|
|
5300
|
-
resumeNext();
|
|
5301
|
-
};
|
|
5302
|
-
const run = async (function_, resolve2, arguments_) => {
|
|
5303
|
-
const result = (async () => function_(...arguments_))();
|
|
5304
|
-
resolve2(result);
|
|
5305
|
-
try {
|
|
5306
|
-
await result;
|
|
5307
|
-
} catch {
|
|
5308
|
-
}
|
|
5309
|
-
next();
|
|
5310
|
-
};
|
|
5311
|
-
const enqueue = (function_, resolve2, reject, arguments_) => {
|
|
5312
|
-
const queueItem = { reject };
|
|
5313
|
-
new Promise((internalResolve) => {
|
|
5314
|
-
queueItem.run = internalResolve;
|
|
5315
|
-
queue.enqueue(queueItem);
|
|
5316
|
-
}).then(run.bind(void 0, function_, resolve2, arguments_));
|
|
5317
|
-
if (activeCount < concurrency) resumeNext();
|
|
5318
|
-
};
|
|
5319
|
-
const generator = (function_, ...arguments_) => new Promise((resolve2, reject) => {
|
|
5320
|
-
enqueue(function_, resolve2, reject, arguments_);
|
|
5321
|
-
});
|
|
5322
|
-
Object.defineProperties(generator, {
|
|
5323
|
-
activeCount: { get: () => activeCount },
|
|
5324
|
-
pendingCount: { get: () => queue.size },
|
|
5325
|
-
clearQueue: { value() {
|
|
5326
|
-
if (!rejectOnClear) {
|
|
5327
|
-
queue.clear();
|
|
5328
|
-
return;
|
|
5329
|
-
}
|
|
5330
|
-
const abortError = AbortSignal.abort().reason;
|
|
5331
|
-
while (queue.size > 0) queue.dequeue().reject(abortError);
|
|
5332
|
-
} },
|
|
5333
|
-
concurrency: {
|
|
5334
|
-
get: () => concurrency,
|
|
5335
|
-
set(newConcurrency) {
|
|
5336
|
-
validateConcurrency(newConcurrency);
|
|
5337
|
-
concurrency = newConcurrency;
|
|
5338
|
-
queueMicrotask(() => {
|
|
5339
|
-
while (activeCount < concurrency && queue.size > 0) resumeNext();
|
|
5340
|
-
});
|
|
5341
|
-
}
|
|
5342
|
-
},
|
|
5343
|
-
map: { async value(iterable, function_) {
|
|
5344
|
-
const promises = Array.from(iterable, (value, index) => this(function_, value, index));
|
|
5345
|
-
return Promise.all(promises);
|
|
5346
|
-
} }
|
|
5347
|
-
});
|
|
5348
|
-
return generator;
|
|
5349
|
-
}
|
|
5350
|
-
function validateConcurrency(concurrency) {
|
|
5351
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
5352
|
-
}
|
|
5353
|
-
function isHookStylePlugin(plugin) {
|
|
5354
|
-
return typeof plugin === "object" && plugin !== null && "hooks" in plugin;
|
|
5140
|
+
return value.match(pattern) !== null;
|
|
5355
5141
|
}
|
|
5356
5142
|
function matchesOperationPattern(node, type, pattern) {
|
|
5357
|
-
var _a2
|
|
5143
|
+
var _a2;
|
|
5358
5144
|
switch (type) {
|
|
5359
5145
|
case "tag":
|
|
5360
|
-
return node.tags.some((tag) =>
|
|
5146
|
+
return node.tags.some((tag) => testPattern(tag, pattern));
|
|
5361
5147
|
case "operationId":
|
|
5362
|
-
return
|
|
5148
|
+
return testPattern(node.operationId, pattern);
|
|
5363
5149
|
case "path":
|
|
5364
|
-
return
|
|
5150
|
+
return testPattern(node.path, pattern);
|
|
5365
5151
|
case "method":
|
|
5366
|
-
return
|
|
5152
|
+
return testPattern(node.method.toLowerCase(), pattern);
|
|
5367
5153
|
case "contentType":
|
|
5368
|
-
return
|
|
5154
|
+
return ((_a2 = node.requestBody) == null ? void 0 : _a2.contentType) ? testPattern(node.requestBody.contentType, pattern) : false;
|
|
5369
5155
|
default:
|
|
5370
5156
|
return false;
|
|
5371
5157
|
}
|
|
@@ -5373,7 +5159,7 @@ function matchesOperationPattern(node, type, pattern) {
|
|
|
5373
5159
|
function matchesSchemaPattern(node, type, pattern) {
|
|
5374
5160
|
switch (type) {
|
|
5375
5161
|
case "schemaName":
|
|
5376
|
-
return node.name ?
|
|
5162
|
+
return node.name ? testPattern(node.name, pattern) : false;
|
|
5377
5163
|
default:
|
|
5378
5164
|
return null;
|
|
5379
5165
|
}
|
|
@@ -5520,7 +5306,7 @@ function mergeFile(a, b) {
|
|
|
5520
5306
|
exports: [...a.exports || [], ...b.exports || []]
|
|
5521
5307
|
};
|
|
5522
5308
|
}
|
|
5523
|
-
var FileManager = (
|
|
5309
|
+
var FileManager = (_a$1 = class {
|
|
5524
5310
|
constructor() {
|
|
5525
5311
|
__privateAdd$1(this, _cache, /* @__PURE__ */ new Map());
|
|
5526
5312
|
__privateAdd$1(this, _filesCache, null);
|
|
@@ -5532,17 +5318,16 @@ var FileManager = (_c$1 = class {
|
|
|
5532
5318
|
add(...files) {
|
|
5533
5319
|
const resolvedFiles = [];
|
|
5534
5320
|
const mergedFiles = /* @__PURE__ */ new Map();
|
|
5535
|
-
|
|
5321
|
+
for (const file of files) {
|
|
5536
5322
|
const existing = mergedFiles.get(file.path);
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
});
|
|
5323
|
+
mergedFiles.set(file.path, existing ? mergeFile(existing, file) : file);
|
|
5324
|
+
}
|
|
5540
5325
|
for (const file of mergedFiles.values()) {
|
|
5541
5326
|
const resolvedFile = createFile(file);
|
|
5542
5327
|
__privateGet$1(this, _cache).set(resolvedFile.path, resolvedFile);
|
|
5543
|
-
__privateSet$1(this, _filesCache, null);
|
|
5544
5328
|
resolvedFiles.push(resolvedFile);
|
|
5545
5329
|
}
|
|
5330
|
+
__privateSet$1(this, _filesCache, null);
|
|
5546
5331
|
return resolvedFiles;
|
|
5547
5332
|
}
|
|
5548
5333
|
/**
|
|
@@ -5552,18 +5337,17 @@ var FileManager = (_c$1 = class {
|
|
|
5552
5337
|
upsert(...files) {
|
|
5553
5338
|
const resolvedFiles = [];
|
|
5554
5339
|
const mergedFiles = /* @__PURE__ */ new Map();
|
|
5555
|
-
|
|
5340
|
+
for (const file of files) {
|
|
5556
5341
|
const existing = mergedFiles.get(file.path);
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
});
|
|
5342
|
+
mergedFiles.set(file.path, existing ? mergeFile(existing, file) : file);
|
|
5343
|
+
}
|
|
5560
5344
|
for (const file of mergedFiles.values()) {
|
|
5561
5345
|
const existing = __privateGet$1(this, _cache).get(file.path);
|
|
5562
5346
|
const resolvedFile = createFile(existing ? mergeFile(existing, file) : file);
|
|
5563
5347
|
__privateGet$1(this, _cache).set(resolvedFile.path, resolvedFile);
|
|
5564
|
-
__privateSet$1(this, _filesCache, null);
|
|
5565
5348
|
resolvedFiles.push(resolvedFile);
|
|
5566
5349
|
}
|
|
5350
|
+
__privateSet$1(this, _filesCache, null);
|
|
5567
5351
|
return resolvedFiles;
|
|
5568
5352
|
}
|
|
5569
5353
|
getByPath(path2) {
|
|
@@ -5584,10 +5368,17 @@ var FileManager = (_c$1 = class {
|
|
|
5584
5368
|
*/
|
|
5585
5369
|
get files() {
|
|
5586
5370
|
if (__privateGet$1(this, _filesCache)) return __privateGet$1(this, _filesCache);
|
|
5587
|
-
const keys = [...__privateGet$1(this, _cache).keys()]
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5371
|
+
const keys = [...__privateGet$1(this, _cache).keys()];
|
|
5372
|
+
const meta = /* @__PURE__ */ new Map();
|
|
5373
|
+
for (const key of keys) meta.set(key, {
|
|
5374
|
+
length: key.length,
|
|
5375
|
+
isIndex: trimExtName$1(key).endsWith(BARREL_BASENAME)
|
|
5376
|
+
});
|
|
5377
|
+
keys.sort((a, b) => {
|
|
5378
|
+
const ma = meta.get(a);
|
|
5379
|
+
const mb = meta.get(b);
|
|
5380
|
+
if (ma.length !== mb.length) return ma.length - mb.length;
|
|
5381
|
+
if (ma.isIndex !== mb.isIndex) return ma.isIndex ? 1 : -1;
|
|
5591
5382
|
return 0;
|
|
5592
5383
|
});
|
|
5593
5384
|
const files = [];
|
|
@@ -5598,7 +5389,7 @@ var FileManager = (_c$1 = class {
|
|
|
5598
5389
|
__privateSet$1(this, _filesCache, files);
|
|
5599
5390
|
return files;
|
|
5600
5391
|
}
|
|
5601
|
-
}, _cache = new WeakMap(), _filesCache = new WeakMap(),
|
|
5392
|
+
}, _cache = new WeakMap(), _filesCache = new WeakMap(), _a$1);
|
|
5602
5393
|
async function applyHookResult(result, driver, rendererFactory) {
|
|
5603
5394
|
if (!result) return;
|
|
5604
5395
|
if (Array.isArray(result)) {
|
|
@@ -5611,31 +5402,7 @@ async function applyHookResult(result, driver, rendererFactory) {
|
|
|
5611
5402
|
driver.fileManager.upsert(...renderer.files);
|
|
5612
5403
|
renderer.unmount();
|
|
5613
5404
|
}
|
|
5614
|
-
|
|
5615
|
-
return promises.filter(Boolean).reduce((promise, func) => {
|
|
5616
|
-
if (typeof func !== "function") throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
|
|
5617
|
-
return promise.then((state) => {
|
|
5618
|
-
const calledFunc = func(state);
|
|
5619
|
-
if (calledFunc) return calledFunc.then(Array.prototype.concat.bind(state));
|
|
5620
|
-
return state;
|
|
5621
|
-
});
|
|
5622
|
-
}, Promise.resolve([]));
|
|
5623
|
-
}
|
|
5624
|
-
function hookFirst(promises, nullCheck = (state) => state !== null) {
|
|
5625
|
-
let promise = Promise.resolve(null);
|
|
5626
|
-
for (const func of promises.filter(Boolean)) promise = promise.then((state) => {
|
|
5627
|
-
if (nullCheck(state)) return state;
|
|
5628
|
-
return func(state);
|
|
5629
|
-
});
|
|
5630
|
-
return promise;
|
|
5631
|
-
}
|
|
5632
|
-
function hookParallel(promises, concurrency = Number.POSITIVE_INFINITY) {
|
|
5633
|
-
const limit = pLimit(concurrency);
|
|
5634
|
-
const tasks = promises.filter(Boolean).map((promise) => limit(() => promise()));
|
|
5635
|
-
return Promise.allSettled(tasks);
|
|
5636
|
-
}
|
|
5637
|
-
const hookFirstNullCheck = (state) => !!(state == null ? void 0 : state.result);
|
|
5638
|
-
var PluginDriver = (_d$1 = class {
|
|
5405
|
+
var PluginDriver = (_b$1 = class {
|
|
5639
5406
|
constructor(config, options) {
|
|
5640
5407
|
__privateAdd$1(this, _PluginDriver_instances);
|
|
5641
5408
|
__publicField$1(this, "config");
|
|
@@ -5662,62 +5429,9 @@ var PluginDriver = (_d$1 = class {
|
|
|
5662
5429
|
__privateAdd$1(this, _resolvers, /* @__PURE__ */ new Map());
|
|
5663
5430
|
__privateAdd$1(this, _defaultResolvers, /* @__PURE__ */ new Map());
|
|
5664
5431
|
__privateAdd$1(this, _hookListeners, /* @__PURE__ */ new Map());
|
|
5665
|
-
/**
|
|
5666
|
-
* @deprecated use resolvers context instead
|
|
5667
|
-
*/
|
|
5668
|
-
__publicField$1(this, "resolvePath", (params) => {
|
|
5669
|
-
var _a2, _b2;
|
|
5670
|
-
const defaultPath = resolve(resolve(this.config.root, this.config.output.path), params.baseName);
|
|
5671
|
-
if (params.pluginName) return ((_a2 = this.hookForPluginSync({
|
|
5672
|
-
pluginName: params.pluginName,
|
|
5673
|
-
hookName: "resolvePath",
|
|
5674
|
-
parameters: [
|
|
5675
|
-
params.baseName,
|
|
5676
|
-
params.mode,
|
|
5677
|
-
params.options
|
|
5678
|
-
]
|
|
5679
|
-
})) == null ? void 0 : _a2.at(0)) || defaultPath;
|
|
5680
|
-
return ((_b2 = this.hookFirstSync({
|
|
5681
|
-
hookName: "resolvePath",
|
|
5682
|
-
parameters: [
|
|
5683
|
-
params.baseName,
|
|
5684
|
-
params.mode,
|
|
5685
|
-
params.options
|
|
5686
|
-
]
|
|
5687
|
-
})) == null ? void 0 : _b2.result) || defaultPath;
|
|
5688
|
-
});
|
|
5689
|
-
/**
|
|
5690
|
-
* @deprecated use resolvers context instead
|
|
5691
|
-
*/
|
|
5692
|
-
__publicField$1(this, "resolveName", (params) => {
|
|
5693
|
-
var _a2, _b2, _c2;
|
|
5694
|
-
if (params.pluginName) return transformReservedWord((_b2 = (_a2 = this.hookForPluginSync({
|
|
5695
|
-
pluginName: params.pluginName,
|
|
5696
|
-
hookName: "resolveName",
|
|
5697
|
-
parameters: [params.name.trim(), params.type]
|
|
5698
|
-
})) == null ? void 0 : _a2.at(0)) != null ? _b2 : params.name);
|
|
5699
|
-
const name = (_c2 = this.hookFirstSync({
|
|
5700
|
-
hookName: "resolveName",
|
|
5701
|
-
parameters: [params.name.trim(), params.type]
|
|
5702
|
-
})) == null ? void 0 : _c2.result;
|
|
5703
|
-
return transformReservedWord(name != null ? name : params.name);
|
|
5704
|
-
});
|
|
5705
5432
|
this.config = config;
|
|
5706
|
-
this.options =
|
|
5707
|
-
|
|
5708
|
-
hooks: options.hooks
|
|
5709
|
-
};
|
|
5710
|
-
config.plugins.map((rawPlugin) => {
|
|
5711
|
-
var _a2, _b2;
|
|
5712
|
-
if (isHookStylePlugin(rawPlugin)) return __privateMethod$1(this, _PluginDriver_instances, normalizeHookStylePlugin_fn).call(this, rawPlugin);
|
|
5713
|
-
return {
|
|
5714
|
-
...rawPlugin,
|
|
5715
|
-
buildStart: (_a2 = rawPlugin.buildStart) != null ? _a2 : (() => {
|
|
5716
|
-
}),
|
|
5717
|
-
buildEnd: (_b2 = rawPlugin.buildEnd) != null ? _b2 : (() => {
|
|
5718
|
-
})
|
|
5719
|
-
};
|
|
5720
|
-
}).filter((plugin) => {
|
|
5433
|
+
this.options = options;
|
|
5434
|
+
config.plugins.map((rawPlugin) => __privateMethod$1(this, _PluginDriver_instances, normalizePlugin_fn).call(this, rawPlugin)).filter((plugin) => {
|
|
5721
5435
|
if (typeof plugin.apply === "function") return plugin.apply(config);
|
|
5722
5436
|
return true;
|
|
5723
5437
|
}).sort((a, b) => {
|
|
@@ -5743,7 +5457,6 @@ var PluginDriver = (_d$1 = class {
|
|
|
5743
5457
|
return extname(fileOrFolder) ? "single" : "split";
|
|
5744
5458
|
}
|
|
5745
5459
|
get hooks() {
|
|
5746
|
-
if (!this.options.hooks) throw new Error("hooks are not defined");
|
|
5747
5460
|
return this.options.hooks;
|
|
5748
5461
|
}
|
|
5749
5462
|
/**
|
|
@@ -5758,6 +5471,8 @@ var PluginDriver = (_d$1 = class {
|
|
|
5758
5471
|
*
|
|
5759
5472
|
* External tooling can subscribe to any of these events via `hooks.on(...)` to observe
|
|
5760
5473
|
* the plugin lifecycle without modifying plugin behavior.
|
|
5474
|
+
*
|
|
5475
|
+
* @internal
|
|
5761
5476
|
*/
|
|
5762
5477
|
registerPluginHooks(hookPlugin, normalizedPlugin) {
|
|
5763
5478
|
const { hooks } = hookPlugin;
|
|
@@ -5785,16 +5500,13 @@ var PluginDriver = (_d$1 = class {
|
|
|
5785
5500
|
...opts
|
|
5786
5501
|
};
|
|
5787
5502
|
},
|
|
5788
|
-
injectFile: (
|
|
5789
|
-
|
|
5790
|
-
const fileNode = createFile({
|
|
5791
|
-
baseName: file.baseName,
|
|
5792
|
-
path: file.path,
|
|
5793
|
-
sources: (_a3 = file.sources) != null ? _a3 : [],
|
|
5503
|
+
injectFile: ({ sources = [], ...rest }) => {
|
|
5504
|
+
this.fileManager.add(createFile({
|
|
5794
5505
|
imports: [],
|
|
5795
|
-
exports: []
|
|
5796
|
-
|
|
5797
|
-
|
|
5506
|
+
exports: [],
|
|
5507
|
+
sources,
|
|
5508
|
+
...rest
|
|
5509
|
+
}));
|
|
5798
5510
|
}
|
|
5799
5511
|
};
|
|
5800
5512
|
return hooks["kubb:plugin:setup"](pluginCtx);
|
|
@@ -5815,23 +5527,18 @@ var PluginDriver = (_d$1 = class {
|
|
|
5815
5527
|
* Call this once from `safeBuild` before the plugin execution loop begins.
|
|
5816
5528
|
*/
|
|
5817
5529
|
async emitSetupHooks() {
|
|
5530
|
+
const noop = () => {
|
|
5531
|
+
};
|
|
5818
5532
|
await this.hooks.emit("kubb:plugin:setup", {
|
|
5819
5533
|
config: this.config,
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
setResolver:
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
setOptions: () => {
|
|
5829
|
-
},
|
|
5830
|
-
injectFile: () => {
|
|
5831
|
-
},
|
|
5832
|
-
updateConfig: () => {
|
|
5833
|
-
},
|
|
5834
|
-
options: {}
|
|
5534
|
+
options: {},
|
|
5535
|
+
addGenerator: noop,
|
|
5536
|
+
setResolver: noop,
|
|
5537
|
+
setTransformer: noop,
|
|
5538
|
+
setRenderer: noop,
|
|
5539
|
+
setOptions: noop,
|
|
5540
|
+
injectFile: noop,
|
|
5541
|
+
updateConfig: noop
|
|
5835
5542
|
});
|
|
5836
5543
|
}
|
|
5837
5544
|
/**
|
|
@@ -5890,11 +5597,22 @@ var PluginDriver = (_d$1 = class {
|
|
|
5890
5597
|
hasRegisteredGenerators(pluginName) {
|
|
5891
5598
|
return __privateGet$1(this, _pluginsWithEventGenerators).has(pluginName);
|
|
5892
5599
|
}
|
|
5600
|
+
/**
|
|
5601
|
+
* Unregisters all plugin lifecycle listeners from the shared event emitter.
|
|
5602
|
+
* Called at the end of a build to prevent listener leaks across repeated builds.
|
|
5603
|
+
*
|
|
5604
|
+
* @internal
|
|
5605
|
+
*/
|
|
5893
5606
|
dispose() {
|
|
5894
5607
|
for (const [event, handlers] of __privateGet$1(this, _hookListeners)) for (const handler of handlers) this.hooks.off(event, handler);
|
|
5895
5608
|
__privateGet$1(this, _hookListeners).clear();
|
|
5896
5609
|
__privateGet$1(this, _pluginsWithEventGenerators).clear();
|
|
5897
5610
|
}
|
|
5611
|
+
/**
|
|
5612
|
+
* Merges `partial` with the plugin's default resolver and stores the result.
|
|
5613
|
+
* Also mirrors it onto `plugin.resolver` so callers using `getPlugin(name).resolver`
|
|
5614
|
+
* get the up-to-date resolver without going through `getResolver()`.
|
|
5615
|
+
*/
|
|
5898
5616
|
setPluginResolver(pluginName, partial) {
|
|
5899
5617
|
const merged = {
|
|
5900
5618
|
...__privateMethod$1(this, _PluginDriver_instances, createDefaultResolver_fn).call(this, pluginName),
|
|
@@ -5904,23 +5622,25 @@ var PluginDriver = (_d$1 = class {
|
|
|
5904
5622
|
const plugin = this.plugins.get(pluginName);
|
|
5905
5623
|
if (plugin) plugin.resolver = merged;
|
|
5906
5624
|
}
|
|
5625
|
+
/**
|
|
5626
|
+
* Returns the resolver for the given plugin.
|
|
5627
|
+
*
|
|
5628
|
+
* Resolution order: dynamic resolver set via `setPluginResolver` → static resolver on the
|
|
5629
|
+
* plugin → lazily created default resolver (identity name, no path transforms).
|
|
5630
|
+
*/
|
|
5907
5631
|
getResolver(pluginName) {
|
|
5908
|
-
var _a2;
|
|
5909
|
-
|
|
5910
|
-
if (dynamicResolver) return dynamicResolver;
|
|
5911
|
-
const pluginResolver = (_a2 = this.plugins.get(pluginName)) == null ? void 0 : _a2.resolver;
|
|
5912
|
-
if (pluginResolver) return pluginResolver;
|
|
5913
|
-
return __privateMethod$1(this, _PluginDriver_instances, createDefaultResolver_fn).call(this, pluginName);
|
|
5632
|
+
var _a2, _b2, _c;
|
|
5633
|
+
return (_c = (_b2 = __privateGet$1(this, _resolvers).get(pluginName)) != null ? _b2 : (_a2 = this.plugins.get(pluginName)) == null ? void 0 : _a2.resolver) != null ? _c : __privateMethod$1(this, _PluginDriver_instances, createDefaultResolver_fn).call(this, pluginName);
|
|
5914
5634
|
}
|
|
5915
5635
|
getContext(plugin) {
|
|
5916
5636
|
const driver = this;
|
|
5917
|
-
|
|
5637
|
+
return {
|
|
5918
5638
|
config: driver.config,
|
|
5919
5639
|
get root() {
|
|
5920
5640
|
return resolve(driver.config.root, driver.config.output.path);
|
|
5921
5641
|
},
|
|
5922
5642
|
getMode(output) {
|
|
5923
|
-
return
|
|
5643
|
+
return _b$1.getMode(resolve(driver.config.root, driver.config.output.path, output.path));
|
|
5924
5644
|
},
|
|
5925
5645
|
hooks: driver.hooks,
|
|
5926
5646
|
plugin,
|
|
@@ -5964,188 +5684,6 @@ var PluginDriver = (_d$1 = class {
|
|
|
5964
5684
|
return openInStudio(driver.inputNode, studioUrl, options);
|
|
5965
5685
|
}
|
|
5966
5686
|
};
|
|
5967
|
-
let mergedExtras = {};
|
|
5968
|
-
for (const p of this.plugins.values()) if (typeof p.inject === "function") {
|
|
5969
|
-
const result = p.inject.call(baseContext);
|
|
5970
|
-
if (result !== null && typeof result === "object") mergedExtras = {
|
|
5971
|
-
...mergedExtras,
|
|
5972
|
-
...result
|
|
5973
|
-
};
|
|
5974
|
-
}
|
|
5975
|
-
return {
|
|
5976
|
-
...baseContext,
|
|
5977
|
-
...mergedExtras
|
|
5978
|
-
};
|
|
5979
|
-
}
|
|
5980
|
-
/**
|
|
5981
|
-
* @deprecated use resolvers context instead
|
|
5982
|
-
*/
|
|
5983
|
-
getFile({ name, mode, extname: extname2, pluginName, options }) {
|
|
5984
|
-
const resolvedName = mode ? mode === "single" ? "" : this.resolveName({
|
|
5985
|
-
name,
|
|
5986
|
-
pluginName,
|
|
5987
|
-
type: "file"
|
|
5988
|
-
}) : name;
|
|
5989
|
-
const path2 = this.resolvePath({
|
|
5990
|
-
baseName: `${resolvedName}${extname2}`,
|
|
5991
|
-
mode,
|
|
5992
|
-
pluginName,
|
|
5993
|
-
options
|
|
5994
|
-
});
|
|
5995
|
-
if (!path2) throw new Error(`Filepath should be defined for resolvedName "${resolvedName}" and pluginName "${pluginName}"`);
|
|
5996
|
-
return createFile({
|
|
5997
|
-
path: path2,
|
|
5998
|
-
baseName: basename(path2),
|
|
5999
|
-
meta: { pluginName },
|
|
6000
|
-
sources: [],
|
|
6001
|
-
imports: [],
|
|
6002
|
-
exports: []
|
|
6003
|
-
});
|
|
6004
|
-
}
|
|
6005
|
-
/**
|
|
6006
|
-
* Run a specific hookName for plugin x.
|
|
6007
|
-
*/
|
|
6008
|
-
async hookForPlugin({ pluginName, hookName, parameters }) {
|
|
6009
|
-
const plugin = this.plugins.get(pluginName);
|
|
6010
|
-
if (!plugin) return [null];
|
|
6011
|
-
this.hooks.emit("kubb:plugins:hook:progress:start", {
|
|
6012
|
-
hookName,
|
|
6013
|
-
plugins: [plugin]
|
|
6014
|
-
});
|
|
6015
|
-
const result = await __privateMethod$1(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
6016
|
-
strategy: "hookFirst",
|
|
6017
|
-
hookName,
|
|
6018
|
-
parameters,
|
|
6019
|
-
plugin
|
|
6020
|
-
});
|
|
6021
|
-
this.hooks.emit("kubb:plugins:hook:progress:end", { hookName });
|
|
6022
|
-
return [result];
|
|
6023
|
-
}
|
|
6024
|
-
/**
|
|
6025
|
-
* Run a specific hookName for plugin x.
|
|
6026
|
-
*/
|
|
6027
|
-
hookForPluginSync({ pluginName, hookName, parameters }) {
|
|
6028
|
-
const plugin = this.plugins.get(pluginName);
|
|
6029
|
-
if (!plugin) return null;
|
|
6030
|
-
const result = __privateMethod$1(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
6031
|
-
strategy: "hookFirst",
|
|
6032
|
-
hookName,
|
|
6033
|
-
parameters,
|
|
6034
|
-
plugin
|
|
6035
|
-
});
|
|
6036
|
-
return result !== null ? [result] : [];
|
|
6037
|
-
}
|
|
6038
|
-
/**
|
|
6039
|
-
* Returns the first non-null result.
|
|
6040
|
-
*/
|
|
6041
|
-
async hookFirst({ hookName, parameters, skipped }) {
|
|
6042
|
-
const plugins = [];
|
|
6043
|
-
for (const plugin of this.plugins.values()) if (hookName in plugin && (skipped ? !skipped.has(plugin) : true)) plugins.push(plugin);
|
|
6044
|
-
this.hooks.emit("kubb:plugins:hook:progress:start", {
|
|
6045
|
-
hookName,
|
|
6046
|
-
plugins
|
|
6047
|
-
});
|
|
6048
|
-
const result = await hookFirst(plugins.map((plugin) => {
|
|
6049
|
-
return async () => {
|
|
6050
|
-
const value = await __privateMethod$1(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
6051
|
-
strategy: "hookFirst",
|
|
6052
|
-
hookName,
|
|
6053
|
-
parameters,
|
|
6054
|
-
plugin
|
|
6055
|
-
});
|
|
6056
|
-
return Promise.resolve({
|
|
6057
|
-
plugin,
|
|
6058
|
-
result: value
|
|
6059
|
-
});
|
|
6060
|
-
};
|
|
6061
|
-
}), hookFirstNullCheck);
|
|
6062
|
-
this.hooks.emit("kubb:plugins:hook:progress:end", { hookName });
|
|
6063
|
-
return result;
|
|
6064
|
-
}
|
|
6065
|
-
/**
|
|
6066
|
-
* Returns the first non-null result.
|
|
6067
|
-
*/
|
|
6068
|
-
hookFirstSync({ hookName, parameters, skipped }) {
|
|
6069
|
-
let parseResult = null;
|
|
6070
|
-
for (const plugin of this.plugins.values()) {
|
|
6071
|
-
if (!(hookName in plugin)) continue;
|
|
6072
|
-
if (skipped == null ? void 0 : skipped.has(plugin)) continue;
|
|
6073
|
-
parseResult = {
|
|
6074
|
-
result: __privateMethod$1(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
6075
|
-
strategy: "hookFirst",
|
|
6076
|
-
hookName,
|
|
6077
|
-
parameters,
|
|
6078
|
-
plugin
|
|
6079
|
-
}),
|
|
6080
|
-
plugin
|
|
6081
|
-
};
|
|
6082
|
-
if (parseResult.result != null) break;
|
|
6083
|
-
}
|
|
6084
|
-
return parseResult;
|
|
6085
|
-
}
|
|
6086
|
-
/**
|
|
6087
|
-
* Runs all plugins in parallel based on `this.plugin` order and `dependencies` settings.
|
|
6088
|
-
*/
|
|
6089
|
-
async hookParallel({ hookName, parameters }) {
|
|
6090
|
-
const plugins = [];
|
|
6091
|
-
for (const plugin of this.plugins.values()) if (hookName in plugin) plugins.push(plugin);
|
|
6092
|
-
this.hooks.emit("kubb:plugins:hook:progress:start", {
|
|
6093
|
-
hookName,
|
|
6094
|
-
plugins
|
|
6095
|
-
});
|
|
6096
|
-
const pluginStartTimes = /* @__PURE__ */ new Map();
|
|
6097
|
-
const results = await hookParallel(plugins.map((plugin) => {
|
|
6098
|
-
return () => {
|
|
6099
|
-
pluginStartTimes.set(plugin, performance.now());
|
|
6100
|
-
return __privateMethod$1(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
6101
|
-
strategy: "hookParallel",
|
|
6102
|
-
hookName,
|
|
6103
|
-
parameters,
|
|
6104
|
-
plugin
|
|
6105
|
-
});
|
|
6106
|
-
};
|
|
6107
|
-
}), this.options.concurrency);
|
|
6108
|
-
results.forEach((result, index) => {
|
|
6109
|
-
var _a2;
|
|
6110
|
-
if (isPromiseRejectedResult(result)) {
|
|
6111
|
-
const plugin = plugins[index];
|
|
6112
|
-
if (plugin) {
|
|
6113
|
-
const startTime = (_a2 = pluginStartTimes.get(plugin)) != null ? _a2 : performance.now();
|
|
6114
|
-
this.hooks.emit("kubb:error", result.reason, {
|
|
6115
|
-
plugin,
|
|
6116
|
-
hookName,
|
|
6117
|
-
strategy: "hookParallel",
|
|
6118
|
-
duration: Math.round(performance.now() - startTime),
|
|
6119
|
-
parameters
|
|
6120
|
-
});
|
|
6121
|
-
}
|
|
6122
|
-
}
|
|
6123
|
-
});
|
|
6124
|
-
this.hooks.emit("kubb:plugins:hook:progress:end", { hookName });
|
|
6125
|
-
return results.reduce((acc, result) => {
|
|
6126
|
-
if (result.status === "fulfilled") acc.push(result.value);
|
|
6127
|
-
return acc;
|
|
6128
|
-
}, []);
|
|
6129
|
-
}
|
|
6130
|
-
/**
|
|
6131
|
-
* Execute a lifecycle hook sequentially for all plugins that implement it.
|
|
6132
|
-
*/
|
|
6133
|
-
async hookSeq({ hookName, parameters }) {
|
|
6134
|
-
const plugins = [];
|
|
6135
|
-
for (const plugin of this.plugins.values()) if (hookName in plugin) plugins.push(plugin);
|
|
6136
|
-
this.hooks.emit("kubb:plugins:hook:progress:start", {
|
|
6137
|
-
hookName,
|
|
6138
|
-
plugins
|
|
6139
|
-
});
|
|
6140
|
-
await hookSeq(plugins.map((plugin) => {
|
|
6141
|
-
return () => __privateMethod$1(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
6142
|
-
strategy: "hookSeq",
|
|
6143
|
-
hookName,
|
|
6144
|
-
parameters,
|
|
6145
|
-
plugin
|
|
6146
|
-
});
|
|
6147
|
-
}));
|
|
6148
|
-
this.hooks.emit("kubb:plugins:hook:progress:end", { hookName });
|
|
6149
5687
|
}
|
|
6150
5688
|
getPlugin(pluginName) {
|
|
6151
5689
|
return this.plugins.get(pluginName);
|
|
@@ -6156,16 +5694,10 @@ var PluginDriver = (_d$1 = class {
|
|
|
6156
5694
|
return plugin;
|
|
6157
5695
|
}
|
|
6158
5696
|
}, _studioIsOpen = new WeakMap(), _pluginsWithEventGenerators = new WeakMap(), _resolvers = new WeakMap(), _defaultResolvers = new WeakMap(), _hookListeners = new WeakMap(), _PluginDriver_instances = new WeakSet(), /**
|
|
6159
|
-
* Creates
|
|
5697
|
+
* Creates an `NormalizedPlugin` from a hook-style plugin and registers
|
|
6160
5698
|
* its lifecycle handlers on the `AsyncEventEmitter`.
|
|
6161
|
-
*
|
|
6162
|
-
* The normalized plugin has an empty `buildStart` — generators registered via
|
|
6163
|
-
* `addGenerator()` in `kubb:plugin:setup` are stored on `normalizedPlugin.generators`
|
|
6164
|
-
* and used by `runPluginAstHooks` during the build.
|
|
6165
5699
|
*/
|
|
6166
|
-
|
|
6167
|
-
const generators = [];
|
|
6168
|
-
const driver = this;
|
|
5700
|
+
normalizePlugin_fn = function(hookPlugin) {
|
|
6169
5701
|
const normalizedPlugin = {
|
|
6170
5702
|
name: hookPlugin.name,
|
|
6171
5703
|
dependencies: hookPlugin.dependencies,
|
|
@@ -6173,30 +5705,6 @@ normalizeHookStylePlugin_fn = function(hookPlugin) {
|
|
|
6173
5705
|
output: { path: "." },
|
|
6174
5706
|
exclude: [],
|
|
6175
5707
|
override: []
|
|
6176
|
-
},
|
|
6177
|
-
generators,
|
|
6178
|
-
inject: () => void 0,
|
|
6179
|
-
resolveName(name, type) {
|
|
6180
|
-
return driver.getResolver(hookPlugin.name).default(name, type);
|
|
6181
|
-
},
|
|
6182
|
-
resolvePath(baseName, pathMode, resolveOptions) {
|
|
6183
|
-
const resolver = driver.getResolver(hookPlugin.name);
|
|
6184
|
-
const opts = normalizedPlugin.options;
|
|
6185
|
-
const group = resolveOptions == null ? void 0 : resolveOptions.group;
|
|
6186
|
-
return resolver.resolvePath({
|
|
6187
|
-
baseName,
|
|
6188
|
-
pathMode,
|
|
6189
|
-
tag: group == null ? void 0 : group.tag,
|
|
6190
|
-
path: group == null ? void 0 : group.path
|
|
6191
|
-
}, {
|
|
6192
|
-
root: resolve(driver.config.root, driver.config.output.path),
|
|
6193
|
-
output: opts.output,
|
|
6194
|
-
group: opts.group
|
|
6195
|
-
});
|
|
6196
|
-
},
|
|
6197
|
-
buildStart() {
|
|
6198
|
-
},
|
|
6199
|
-
buildEnd() {
|
|
6200
5708
|
}
|
|
6201
5709
|
};
|
|
6202
5710
|
this.registerPluginHooks(hookPlugin, normalizedPlugin);
|
|
@@ -6217,84 +5725,7 @@ normalizeHookStylePlugin_fn = function(hookPlugin) {
|
|
|
6217
5725
|
}));
|
|
6218
5726
|
__privateGet$1(this, _defaultResolvers).set(pluginName, resolver);
|
|
6219
5727
|
return resolver;
|
|
6220
|
-
},
|
|
6221
|
-
* Emit hook-processing completion metadata after a plugin hook resolves.
|
|
6222
|
-
*/
|
|
6223
|
-
emitProcessingEnd_fn = function({ startTime, output, strategy, hookName, plugin, parameters }) {
|
|
6224
|
-
this.hooks.emit("kubb:plugins:hook:processing:end", {
|
|
6225
|
-
duration: Math.round(performance.now() - startTime),
|
|
6226
|
-
parameters,
|
|
6227
|
-
output,
|
|
6228
|
-
strategy,
|
|
6229
|
-
hookName,
|
|
6230
|
-
plugin
|
|
6231
|
-
});
|
|
6232
|
-
}, execute_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
6233
|
-
const hook = plugin[hookName];
|
|
6234
|
-
if (!hook) return null;
|
|
6235
|
-
this.hooks.emit("kubb:plugins:hook:processing:start", {
|
|
6236
|
-
strategy,
|
|
6237
|
-
hookName,
|
|
6238
|
-
parameters,
|
|
6239
|
-
plugin
|
|
6240
|
-
});
|
|
6241
|
-
const startTime = performance.now();
|
|
6242
|
-
return (async () => {
|
|
6243
|
-
try {
|
|
6244
|
-
const output = typeof hook === "function" ? await Promise.resolve(hook.apply(this.getContext(plugin), parameters != null ? parameters : [])) : hook;
|
|
6245
|
-
__privateMethod$1(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
|
|
6246
|
-
startTime,
|
|
6247
|
-
output,
|
|
6248
|
-
strategy,
|
|
6249
|
-
hookName,
|
|
6250
|
-
plugin,
|
|
6251
|
-
parameters
|
|
6252
|
-
});
|
|
6253
|
-
return output;
|
|
6254
|
-
} catch (error) {
|
|
6255
|
-
this.hooks.emit("kubb:error", error, {
|
|
6256
|
-
plugin,
|
|
6257
|
-
hookName,
|
|
6258
|
-
strategy,
|
|
6259
|
-
duration: Math.round(performance.now() - startTime)
|
|
6260
|
-
});
|
|
6261
|
-
return null;
|
|
6262
|
-
}
|
|
6263
|
-
})();
|
|
6264
|
-
}, /**
|
|
6265
|
-
* Execute a plugin lifecycle hook synchronously and return its output.
|
|
6266
|
-
*/
|
|
6267
|
-
executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
6268
|
-
const hook = plugin[hookName];
|
|
6269
|
-
if (!hook) return null;
|
|
6270
|
-
this.hooks.emit("kubb:plugins:hook:processing:start", {
|
|
6271
|
-
strategy,
|
|
6272
|
-
hookName,
|
|
6273
|
-
parameters,
|
|
6274
|
-
plugin
|
|
6275
|
-
});
|
|
6276
|
-
const startTime = performance.now();
|
|
6277
|
-
try {
|
|
6278
|
-
const output = typeof hook === "function" ? hook.apply(this.getContext(plugin), parameters) : hook;
|
|
6279
|
-
__privateMethod$1(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
|
|
6280
|
-
startTime,
|
|
6281
|
-
output,
|
|
6282
|
-
strategy,
|
|
6283
|
-
hookName,
|
|
6284
|
-
plugin,
|
|
6285
|
-
parameters
|
|
6286
|
-
});
|
|
6287
|
-
return output;
|
|
6288
|
-
} catch (error) {
|
|
6289
|
-
this.hooks.emit("kubb:error", error, {
|
|
6290
|
-
plugin,
|
|
6291
|
-
hookName,
|
|
6292
|
-
strategy,
|
|
6293
|
-
duration: Math.round(performance.now() - startTime)
|
|
6294
|
-
});
|
|
6295
|
-
return null;
|
|
6296
|
-
}
|
|
6297
|
-
}, _d$1);
|
|
5728
|
+
}, _b$1);
|
|
6298
5729
|
|
|
6299
5730
|
var __defProp = Object.defineProperty;
|
|
6300
5731
|
var __typeError = (msg) => {
|
|
@@ -6307,7 +5738,15 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
6307
5738
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
6308
5739
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
6309
5740
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
6310
|
-
var
|
|
5741
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
5742
|
+
set _(value) {
|
|
5743
|
+
__privateSet(obj, member, value);
|
|
5744
|
+
},
|
|
5745
|
+
get _() {
|
|
5746
|
+
return __privateGet(obj, member, getter);
|
|
5747
|
+
}
|
|
5748
|
+
});
|
|
5749
|
+
var _emitter, _a, _options, _URLPath_instances, transformParam_fn, eachParam_fn, _b, _c, _head, _tail, _size, _d, _limit, _e, _cachedLeaves, _f;
|
|
6311
5750
|
var BuildError = class extends Error {
|
|
6312
5751
|
constructor(message, options) {
|
|
6313
5752
|
super(message, { cause: options.cause });
|
|
@@ -6472,6 +5911,14 @@ async function clean(path2) {
|
|
|
6472
5911
|
force: true
|
|
6473
5912
|
});
|
|
6474
5913
|
}
|
|
5914
|
+
function isValidVarName(name) {
|
|
5915
|
+
try {
|
|
5916
|
+
new Function(`var ${name}`);
|
|
5917
|
+
} catch {
|
|
5918
|
+
return false;
|
|
5919
|
+
}
|
|
5920
|
+
return true;
|
|
5921
|
+
}
|
|
6475
5922
|
var URLPath = (_b = class {
|
|
6476
5923
|
constructor(path2, options = {}) {
|
|
6477
5924
|
__privateAdd(this, _URLPath_instances);
|
|
@@ -6607,10 +6054,134 @@ eachParam_fn = function(fn) {
|
|
|
6607
6054
|
fn(raw, __privateMethod(this, _URLPath_instances, transformParam_fn).call(this, raw));
|
|
6608
6055
|
}
|
|
6609
6056
|
}, _b);
|
|
6057
|
+
var Node$1 = (_c = class {
|
|
6058
|
+
constructor(value) {
|
|
6059
|
+
__publicField(this, "value");
|
|
6060
|
+
__publicField(this, "next");
|
|
6061
|
+
this.value = value;
|
|
6062
|
+
}
|
|
6063
|
+
}, __name(_c, "Node"), _c);
|
|
6064
|
+
var Queue = (_d = class {
|
|
6065
|
+
constructor() {
|
|
6066
|
+
__privateAdd(this, _head);
|
|
6067
|
+
__privateAdd(this, _tail);
|
|
6068
|
+
__privateAdd(this, _size);
|
|
6069
|
+
this.clear();
|
|
6070
|
+
}
|
|
6071
|
+
enqueue(value) {
|
|
6072
|
+
const node = new Node$1(value);
|
|
6073
|
+
if (__privateGet(this, _head)) {
|
|
6074
|
+
__privateGet(this, _tail).next = node;
|
|
6075
|
+
__privateSet(this, _tail, node);
|
|
6076
|
+
} else {
|
|
6077
|
+
__privateSet(this, _head, node);
|
|
6078
|
+
__privateSet(this, _tail, node);
|
|
6079
|
+
}
|
|
6080
|
+
__privateWrapper(this, _size)._++;
|
|
6081
|
+
}
|
|
6082
|
+
dequeue() {
|
|
6083
|
+
const current = __privateGet(this, _head);
|
|
6084
|
+
if (!current) return;
|
|
6085
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
6086
|
+
__privateWrapper(this, _size)._--;
|
|
6087
|
+
if (!__privateGet(this, _head)) __privateSet(this, _tail, void 0);
|
|
6088
|
+
return current.value;
|
|
6089
|
+
}
|
|
6090
|
+
peek() {
|
|
6091
|
+
if (!__privateGet(this, _head)) return;
|
|
6092
|
+
return __privateGet(this, _head).value;
|
|
6093
|
+
}
|
|
6094
|
+
clear() {
|
|
6095
|
+
__privateSet(this, _head, void 0);
|
|
6096
|
+
__privateSet(this, _tail, void 0);
|
|
6097
|
+
__privateSet(this, _size, 0);
|
|
6098
|
+
}
|
|
6099
|
+
get size() {
|
|
6100
|
+
return __privateGet(this, _size);
|
|
6101
|
+
}
|
|
6102
|
+
*[Symbol.iterator]() {
|
|
6103
|
+
let current = __privateGet(this, _head);
|
|
6104
|
+
while (current) {
|
|
6105
|
+
yield current.value;
|
|
6106
|
+
current = current.next;
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
*drain() {
|
|
6110
|
+
while (__privateGet(this, _head)) yield this.dequeue();
|
|
6111
|
+
}
|
|
6112
|
+
}, _head = new WeakMap(), _tail = new WeakMap(), _size = new WeakMap(), _d);
|
|
6113
|
+
function pLimit(concurrency) {
|
|
6114
|
+
let rejectOnClear = false;
|
|
6115
|
+
if (typeof concurrency === "object") ({ concurrency, rejectOnClear = false } = concurrency);
|
|
6116
|
+
validateConcurrency(concurrency);
|
|
6117
|
+
if (typeof rejectOnClear !== "boolean") throw new TypeError("Expected `rejectOnClear` to be a boolean");
|
|
6118
|
+
const queue = new Queue();
|
|
6119
|
+
let activeCount = 0;
|
|
6120
|
+
const resumeNext = () => {
|
|
6121
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
6122
|
+
activeCount++;
|
|
6123
|
+
queue.dequeue().run();
|
|
6124
|
+
}
|
|
6125
|
+
};
|
|
6126
|
+
const next = () => {
|
|
6127
|
+
activeCount--;
|
|
6128
|
+
resumeNext();
|
|
6129
|
+
};
|
|
6130
|
+
const run = async (function_, resolve2, arguments_) => {
|
|
6131
|
+
const result = (async () => function_(...arguments_))();
|
|
6132
|
+
resolve2(result);
|
|
6133
|
+
try {
|
|
6134
|
+
await result;
|
|
6135
|
+
} catch {
|
|
6136
|
+
}
|
|
6137
|
+
next();
|
|
6138
|
+
};
|
|
6139
|
+
const enqueue = (function_, resolve2, reject, arguments_) => {
|
|
6140
|
+
const queueItem = { reject };
|
|
6141
|
+
new Promise((internalResolve) => {
|
|
6142
|
+
queueItem.run = internalResolve;
|
|
6143
|
+
queue.enqueue(queueItem);
|
|
6144
|
+
}).then(run.bind(void 0, function_, resolve2, arguments_));
|
|
6145
|
+
if (activeCount < concurrency) resumeNext();
|
|
6146
|
+
};
|
|
6147
|
+
const generator = (function_, ...arguments_) => new Promise((resolve2, reject) => {
|
|
6148
|
+
enqueue(function_, resolve2, reject, arguments_);
|
|
6149
|
+
});
|
|
6150
|
+
Object.defineProperties(generator, {
|
|
6151
|
+
activeCount: { get: () => activeCount },
|
|
6152
|
+
pendingCount: { get: () => queue.size },
|
|
6153
|
+
clearQueue: { value() {
|
|
6154
|
+
if (!rejectOnClear) {
|
|
6155
|
+
queue.clear();
|
|
6156
|
+
return;
|
|
6157
|
+
}
|
|
6158
|
+
const abortError = AbortSignal.abort().reason;
|
|
6159
|
+
while (queue.size > 0) queue.dequeue().reject(abortError);
|
|
6160
|
+
} },
|
|
6161
|
+
concurrency: {
|
|
6162
|
+
get: () => concurrency,
|
|
6163
|
+
set(newConcurrency) {
|
|
6164
|
+
validateConcurrency(newConcurrency);
|
|
6165
|
+
concurrency = newConcurrency;
|
|
6166
|
+
queueMicrotask(() => {
|
|
6167
|
+
while (activeCount < concurrency && queue.size > 0) resumeNext();
|
|
6168
|
+
});
|
|
6169
|
+
}
|
|
6170
|
+
},
|
|
6171
|
+
map: { async value(iterable, function_) {
|
|
6172
|
+
const promises = Array.from(iterable, (value, index) => this(function_, value, index));
|
|
6173
|
+
return Promise.all(promises);
|
|
6174
|
+
} }
|
|
6175
|
+
});
|
|
6176
|
+
return generator;
|
|
6177
|
+
}
|
|
6178
|
+
function validateConcurrency(concurrency) {
|
|
6179
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
6180
|
+
}
|
|
6610
6181
|
function joinSources(file) {
|
|
6611
6182
|
return file.sources.map((item) => extractStringsFromNodes(item.nodes)).filter(Boolean).join("\n\n");
|
|
6612
6183
|
}
|
|
6613
|
-
var FileProcessor = (
|
|
6184
|
+
var FileProcessor = (_e = class {
|
|
6614
6185
|
constructor() {
|
|
6615
6186
|
__privateAdd(this, _limit, pLimit(100));
|
|
6616
6187
|
}
|
|
@@ -6645,7 +6216,7 @@ var FileProcessor = (_c = class {
|
|
|
6645
6216
|
await (onEnd == null ? void 0 : onEnd(files));
|
|
6646
6217
|
return files;
|
|
6647
6218
|
}
|
|
6648
|
-
}, _limit = new WeakMap(),
|
|
6219
|
+
}, _limit = new WeakMap(), _e);
|
|
6649
6220
|
function createStorage(build2) {
|
|
6650
6221
|
return (options) => build2(options != null ? options : {});
|
|
6651
6222
|
}
|
|
@@ -6702,7 +6273,7 @@ const fsStorage = createStorage(() => ({
|
|
|
6702
6273
|
await clean(resolve(base));
|
|
6703
6274
|
}
|
|
6704
6275
|
}));
|
|
6705
|
-
var version$1 = "5.0.0-alpha.
|
|
6276
|
+
var version$1 = "5.0.0-alpha.44";
|
|
6706
6277
|
function getDiagnosticInfo() {
|
|
6707
6278
|
return {
|
|
6708
6279
|
nodeVersion: version$2,
|
|
@@ -6712,7 +6283,7 @@ function getDiagnosticInfo() {
|
|
|
6712
6283
|
cwd: process.cwd()
|
|
6713
6284
|
};
|
|
6714
6285
|
}
|
|
6715
|
-
var TreeNode = (
|
|
6286
|
+
var TreeNode = (_f = class {
|
|
6716
6287
|
constructor(data, parent) {
|
|
6717
6288
|
__publicField(this, "data");
|
|
6718
6289
|
__publicField(this, "parent");
|
|
@@ -6722,7 +6293,7 @@ var TreeNode = (_d = class {
|
|
|
6722
6293
|
this.parent = parent;
|
|
6723
6294
|
}
|
|
6724
6295
|
addChild(data) {
|
|
6725
|
-
const child = new
|
|
6296
|
+
const child = new _f(data, this);
|
|
6726
6297
|
if (!this.children) this.children = [];
|
|
6727
6298
|
this.children.push(child);
|
|
6728
6299
|
return child;
|
|
@@ -6795,7 +6366,7 @@ var TreeNode = (_d = class {
|
|
|
6795
6366
|
try {
|
|
6796
6367
|
const filteredTree = buildDirectoryTree(files, root);
|
|
6797
6368
|
if (!filteredTree) return null;
|
|
6798
|
-
const treeNode = new
|
|
6369
|
+
const treeNode = new _f({
|
|
6799
6370
|
name: filteredTree.name,
|
|
6800
6371
|
path: filteredTree.path,
|
|
6801
6372
|
file: filteredTree.file,
|
|
@@ -6821,7 +6392,7 @@ var TreeNode = (_d = class {
|
|
|
6821
6392
|
throw new Error("Something went wrong with creating barrel files with the TreeNode class", { cause: error });
|
|
6822
6393
|
}
|
|
6823
6394
|
}
|
|
6824
|
-
}, _cachedLeaves = new WeakMap(),
|
|
6395
|
+
}, _cachedLeaves = new WeakMap(), _f);
|
|
6825
6396
|
const normalizePath = (p) => p.replaceAll("\\", "/");
|
|
6826
6397
|
function buildDirectoryTree(files, rootFolder = "") {
|
|
6827
6398
|
const normalizedRootFolder = normalizePath(rootFolder);
|
|
@@ -6868,8 +6439,8 @@ function getBarrelFilesByRoot(root, files) {
|
|
|
6868
6439
|
var _a3, _b2;
|
|
6869
6440
|
if (!(treeNode == null ? void 0 : treeNode.children) || !((_a3 = treeNode.parent) == null ? void 0 : _a3.data.path)) return;
|
|
6870
6441
|
const barrelFile = createFile({
|
|
6871
|
-
path: join((_b2 = treeNode.parent) == null ? void 0 : _b2.data.path,
|
|
6872
|
-
baseName:
|
|
6442
|
+
path: join((_b2 = treeNode.parent) == null ? void 0 : _b2.data.path, BARREL_FILENAME),
|
|
6443
|
+
baseName: BARREL_FILENAME,
|
|
6873
6444
|
exports: [],
|
|
6874
6445
|
imports: [],
|
|
6875
6446
|
sources: []
|
|
@@ -6934,7 +6505,7 @@ function isInputPath(config) {
|
|
|
6934
6505
|
return typeof (config == null ? void 0 : config.input) === "object" && config.input !== null && "path" in config.input;
|
|
6935
6506
|
}
|
|
6936
6507
|
async function setup(userConfig, options = {}) {
|
|
6937
|
-
var _a2, _b2, _c2, _d2,
|
|
6508
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
|
|
6938
6509
|
const hooks = (_a2 = options.hooks) != null ? _a2 : new AsyncEventEmitter();
|
|
6939
6510
|
const sources = /* @__PURE__ */ new Map();
|
|
6940
6511
|
const diagnosticInfo = getDiagnosticInfo();
|
|
@@ -6948,8 +6519,8 @@ async function setup(userConfig, options = {}) {
|
|
|
6948
6519
|
` \u2022 Output: ${((_b2 = userConfig.output) == null ? void 0 : _b2.path) || "not specified"}`,
|
|
6949
6520
|
` \u2022 Plugins: ${((_c2 = userConfig.plugins) == null ? void 0 : _c2.length) || 0}`,
|
|
6950
6521
|
"Output Settings:",
|
|
6951
|
-
` \u2022 Storage: ${((_d2 = userConfig.output) == null ? void 0 : _d2.storage) ? `custom(${userConfig.output.storage.name})` : ((
|
|
6952
|
-
` \u2022 Formatter: ${((
|
|
6522
|
+
` \u2022 Storage: ${((_d2 = userConfig.output) == null ? void 0 : _d2.storage) ? `custom(${userConfig.output.storage.name})` : ((_e2 = userConfig.output) == null ? void 0 : _e2.write) === false ? "disabled" : "filesystem (default)"}`,
|
|
6523
|
+
` \u2022 Formatter: ${((_f2 = userConfig.output) == null ? void 0 : _f2.format) || "none"}`,
|
|
6953
6524
|
` \u2022 Linter: ${((_g = userConfig.output) == null ? void 0 : _g.lint) || "none"}`,
|
|
6954
6525
|
"Environment:",
|
|
6955
6526
|
Object.entries(diagnosticInfo).map(([key, value]) => ` \u2022 ${key}: ${value}`).join("\n")
|
|
@@ -6996,10 +6567,7 @@ async function setup(userConfig, options = {}) {
|
|
|
6996
6567
|
});
|
|
6997
6568
|
await (storage == null ? void 0 : storage.clear(resolve(config.root, config.output.path)));
|
|
6998
6569
|
}
|
|
6999
|
-
const driver = new PluginDriver(config, {
|
|
7000
|
-
hooks,
|
|
7001
|
-
concurrency: 15
|
|
7002
|
-
});
|
|
6570
|
+
const driver = new PluginDriver(config, { hooks });
|
|
7003
6571
|
const adapter = config.adapter;
|
|
7004
6572
|
if (!adapter) throw new Error("No adapter configured. Please provide an adapter in your kubb.config.ts.");
|
|
7005
6573
|
const source = inputToAdapterSource(config);
|
|
@@ -7096,7 +6664,7 @@ async function runPluginAstHooks(plugin, context) {
|
|
|
7096
6664
|
}
|
|
7097
6665
|
}
|
|
7098
6666
|
async function safeBuild(setupResult) {
|
|
7099
|
-
var _a2, _b2, _c2, _d2,
|
|
6667
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7100
6668
|
const { driver, hooks, sources, storage } = setupResult;
|
|
7101
6669
|
const failedPlugins = /* @__PURE__ */ new Set();
|
|
7102
6670
|
const pluginTimings = /* @__PURE__ */ new Map();
|
|
@@ -7121,7 +6689,6 @@ async function safeBuild(setupResult) {
|
|
|
7121
6689
|
date: timestamp,
|
|
7122
6690
|
logs: ["Starting plugin...", ` \u2022 Plugin Name: ${plugin.name}`]
|
|
7123
6691
|
});
|
|
7124
|
-
await plugin.buildStart.call(context);
|
|
7125
6692
|
if (((_b2 = plugin.generators) == null ? void 0 : _b2.length) || driver.hasRegisteredGenerators(plugin.name)) await runPluginAstHooks(plugin, context);
|
|
7126
6693
|
if (output) {
|
|
7127
6694
|
const barrelFiles = await getBarrelFiles(driver.fileManager.files, {
|
|
@@ -7192,7 +6759,7 @@ async function safeBuild(setupResult) {
|
|
|
7192
6759
|
exports: buildBarrelExports({
|
|
7193
6760
|
barrelFiles,
|
|
7194
6761
|
rootDir,
|
|
7195
|
-
existingExports: new Set((
|
|
6762
|
+
existingExports: new Set((_e2 = (_d2 = existingBarrel == null ? void 0 : existingBarrel.exports) == null ? void 0 : _d2.flatMap((e) => Array.isArray(e.name) ? e.name : [e.name]).filter((n) => Boolean(n))) != null ? _e2 : []),
|
|
7196
6763
|
config,
|
|
7197
6764
|
driver
|
|
7198
6765
|
}).map((e) => createExport(e)),
|
|
@@ -7203,7 +6770,7 @@ async function safeBuild(setupResult) {
|
|
|
7203
6770
|
driver.fileManager.upsert(rootFile);
|
|
7204
6771
|
await hooks.emit("kubb:debug", {
|
|
7205
6772
|
date: /* @__PURE__ */ new Date(),
|
|
7206
|
-
logs: [`\u2713 Generated barrel file (${((
|
|
6773
|
+
logs: [`\u2713 Generated barrel file (${((_f2 = rootFile.exports) == null ? void 0 : _f2.length) || 0} exports)`]
|
|
7207
6774
|
});
|
|
7208
6775
|
}
|
|
7209
6776
|
const files = driver.fileManager.files;
|
|
@@ -7242,10 +6809,6 @@ async function safeBuild(setupResult) {
|
|
|
7242
6809
|
});
|
|
7243
6810
|
}
|
|
7244
6811
|
});
|
|
7245
|
-
for (const plugin of driver.plugins.values()) if (plugin.buildEnd) {
|
|
7246
|
-
const context = driver.getContext(plugin);
|
|
7247
|
-
await plugin.buildEnd.call(context);
|
|
7248
|
-
}
|
|
7249
6812
|
await hooks.emit("kubb:build:end", {
|
|
7250
6813
|
files,
|
|
7251
6814
|
config,
|
|
@@ -7390,7 +6953,7 @@ const memoryStorage = createStorage(() => {
|
|
|
7390
6953
|
};
|
|
7391
6954
|
});
|
|
7392
6955
|
|
|
7393
|
-
var version = "5.0.0-alpha.
|
|
6956
|
+
var version = "5.0.0-alpha.44";
|
|
7394
6957
|
|
|
7395
6958
|
function isCommandMessage(msg) {
|
|
7396
6959
|
return msg.type === "command";
|
|
@@ -7598,9 +7161,7 @@ async function loadPluginFactory(packageName) {
|
|
|
7598
7161
|
if (typeof mod["default"] === "function") return mod["default"];
|
|
7599
7162
|
const firstFn = Object.values(mod).find((v) => typeof v === "function");
|
|
7600
7163
|
if (firstFn) return firstFn;
|
|
7601
|
-
throw new Error(
|
|
7602
|
-
`Plugin "${packageName}" does not export a callable factory. Tried: named export "${exportName}", "default", and any exported function.`
|
|
7603
|
-
);
|
|
7164
|
+
throw new Error(`Plugin "${packageName}" does not export a callable factory. Tried: named export "${exportName}", "default", and any exported function.`);
|
|
7604
7165
|
}
|
|
7605
7166
|
async function resolvePlugins(plugins) {
|
|
7606
7167
|
return Promise.all(
|