@kubb/core 3.0.0-alpha.10 → 3.0.0-alpha.11
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-2EU7DMPM.js +2 -3
- package/dist/chunk-2EU7DMPM.js.map +1 -1
- package/dist/chunk-4X5FFJPJ.js +8 -13
- package/dist/chunk-4X5FFJPJ.js.map +1 -1
- package/dist/{chunk-NB4JMN75.cjs → chunk-52WA2JF5.cjs} +130 -142
- package/dist/chunk-52WA2JF5.cjs.map +1 -0
- package/dist/{chunk-SEH6NUCX.cjs → chunk-ADFKVVPE.cjs} +10 -10
- package/dist/chunk-ADFKVVPE.cjs.map +1 -0
- package/dist/{chunk-MU3CBCQT.js → chunk-E6CN2CZC.js} +12 -27
- package/dist/chunk-E6CN2CZC.js.map +1 -0
- package/dist/chunk-HBQM723K.js +12 -26
- package/dist/chunk-HBQM723K.js.map +1 -1
- package/dist/{chunk-A6PCLWEY.cjs → chunk-HMCSWG5L.cjs} +25 -26
- package/dist/chunk-HMCSWG5L.cjs.map +1 -0
- package/dist/chunk-L6YLVCKM.js +14 -49
- package/dist/chunk-L6YLVCKM.js.map +1 -1
- package/dist/{chunk-5E2I6KH4.cjs → chunk-PJLUPV3P.cjs} +54 -37
- package/dist/chunk-PJLUPV3P.cjs.map +1 -0
- package/dist/{chunk-DID47EQD.cjs → chunk-TTDCUWK7.cjs} +6 -7
- package/dist/chunk-TTDCUWK7.cjs.map +1 -0
- package/dist/{chunk-M7NLNCSM.cjs → chunk-YEVCYV36.cjs} +33 -36
- package/dist/chunk-YEVCYV36.cjs.map +1 -0
- package/dist/index.cjs +138 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -47
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +25 -14
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +3 -13
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +13 -18
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.js +5 -12
- package/dist/mocks.js.map +1 -1
- package/dist/{prompt-DVQN7JTN.cjs → prompt-L5KFKY73.cjs} +89 -89
- package/dist/prompt-L5KFKY73.cjs.map +1 -0
- package/dist/prompt-WQQUN22Z.js +8 -13
- package/dist/prompt-WQQUN22Z.js.map +1 -1
- package/dist/transformers.cjs +62 -52
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +9 -37
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +65 -34
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +3 -33
- package/dist/utils.js.map +1 -1
- package/package.json +7 -7
- package/src/logger.ts +3 -3
- package/dist/chunk-5E2I6KH4.cjs.map +0 -1
- package/dist/chunk-A6PCLWEY.cjs.map +0 -1
- package/dist/chunk-DID47EQD.cjs.map +0 -1
- package/dist/chunk-M7NLNCSM.cjs.map +0 -1
- package/dist/chunk-MU3CBCQT.js.map +0 -1
- package/dist/chunk-NB4JMN75.cjs.map +0 -1
- package/dist/chunk-SEH6NUCX.cjs.map +0 -1
- package/dist/prompt-DVQN7JTN.cjs.map +0 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkHMCSWG5L_cjs = require('./chunk-HMCSWG5L.cjs');
|
|
4
|
+
var chunkADFKVVPE_cjs = require('./chunk-ADFKVVPE.cjs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var fs = require('@kubb/fs');
|
|
7
|
+
var hash = require('object-hash');
|
|
8
|
+
var remeda = require('remeda');
|
|
3
9
|
|
|
4
|
-
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkSEH6NUCXcjs = require('./chunk-SEH6NUCX.cjs');
|
|
12
|
+
var hash__default = /*#__PURE__*/_interopDefault(hash);
|
|
10
13
|
|
|
11
14
|
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
12
|
-
var require_eventemitter3 =
|
|
15
|
+
var require_eventemitter3 = chunkADFKVVPE_cjs.__commonJS({
|
|
13
16
|
"../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
|
|
14
|
-
|
|
15
|
-
_chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
|
|
17
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
16
18
|
var has = Object.prototype.hasOwnProperty;
|
|
17
19
|
var prefix = "~";
|
|
18
20
|
function Events() {
|
|
@@ -172,10 +174,10 @@ var require_eventemitter3 = _chunkSEH6NUCXcjs.__commonJS.call(void 0, {
|
|
|
172
174
|
});
|
|
173
175
|
|
|
174
176
|
// src/utils/index.ts
|
|
175
|
-
|
|
177
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
176
178
|
|
|
177
179
|
// src/utils/FunctionParams.ts
|
|
178
|
-
|
|
180
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
179
181
|
var FunctionParams = class _FunctionParams {
|
|
180
182
|
#items = [];
|
|
181
183
|
constructor() {
|
|
@@ -196,7 +198,7 @@ var FunctionParams = class _FunctionParams {
|
|
|
196
198
|
return this;
|
|
197
199
|
}
|
|
198
200
|
static #orderItems(items) {
|
|
199
|
-
return
|
|
201
|
+
return chunkHMCSWG5L_cjs.orderBy(
|
|
200
202
|
items.filter(Boolean),
|
|
201
203
|
[
|
|
202
204
|
(v) => {
|
|
@@ -209,7 +211,7 @@ var FunctionParams = class _FunctionParams {
|
|
|
209
211
|
if (Array.isArray(v)) {
|
|
210
212
|
return void 0;
|
|
211
213
|
}
|
|
212
|
-
return
|
|
214
|
+
return v.required ?? true;
|
|
213
215
|
}
|
|
214
216
|
],
|
|
215
217
|
["desc", "desc"]
|
|
@@ -224,7 +226,7 @@ var FunctionParams = class _FunctionParams {
|
|
|
224
226
|
acc.push(`${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
225
227
|
return acc;
|
|
226
228
|
}
|
|
227
|
-
const parameterName = name.startsWith("{") ? name :
|
|
229
|
+
const parameterName = name.startsWith("{") ? name : chunkHMCSWG5L_cjs.camelCase(name);
|
|
228
230
|
if (type) {
|
|
229
231
|
if (required) {
|
|
230
232
|
acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
@@ -239,8 +241,8 @@ var FunctionParams = class _FunctionParams {
|
|
|
239
241
|
static toObject(items) {
|
|
240
242
|
let type = [];
|
|
241
243
|
let name = [];
|
|
242
|
-
const enabled = items.every((item) => item.enabled) ?
|
|
243
|
-
const required =
|
|
244
|
+
const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true;
|
|
245
|
+
const required = items.every((item) => item.required) ?? true;
|
|
244
246
|
items.forEach((item) => {
|
|
245
247
|
name = _FunctionParams.#addParams(name, { ...item, type: void 0 });
|
|
246
248
|
if (items.some((item2) => item2.type)) {
|
|
@@ -279,9 +281,9 @@ var FunctionParams = class _FunctionParams {
|
|
|
279
281
|
};
|
|
280
282
|
|
|
281
283
|
// src/utils/promise.ts
|
|
282
|
-
|
|
284
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
283
285
|
function isPromise(result) {
|
|
284
|
-
return !!result && typeof
|
|
286
|
+
return !!result && typeof result?.then === "function";
|
|
285
287
|
}
|
|
286
288
|
function isPromiseFulfilledResult(result) {
|
|
287
289
|
return result.status === "fulfilled";
|
|
@@ -291,14 +293,14 @@ function isPromiseRejectedResult(result) {
|
|
|
291
293
|
}
|
|
292
294
|
|
|
293
295
|
// src/utils/renderTemplate.ts
|
|
294
|
-
|
|
296
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
295
297
|
function renderTemplate(template, data = void 0) {
|
|
296
298
|
if (!data || !Object.keys(data).length) {
|
|
297
299
|
return template.replace(/{{(.*?)}}/g, "");
|
|
298
300
|
}
|
|
299
301
|
const matches = template.match(/{{(.*?)}}/g);
|
|
300
|
-
return
|
|
301
|
-
const index =
|
|
302
|
+
return matches?.reduce((prev, curr) => {
|
|
303
|
+
const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim();
|
|
302
304
|
if (index === void 0) {
|
|
303
305
|
return prev;
|
|
304
306
|
}
|
|
@@ -312,11 +314,11 @@ function renderTemplate(template, data = void 0) {
|
|
|
312
314
|
}
|
|
313
315
|
return value || "";
|
|
314
316
|
}).trim();
|
|
315
|
-
}, template)
|
|
317
|
+
}, template) || "";
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
// src/utils/timeout.ts
|
|
319
|
-
|
|
321
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
320
322
|
async function timeout(ms) {
|
|
321
323
|
return new Promise((resolve) => {
|
|
322
324
|
setTimeout(() => {
|
|
@@ -326,7 +328,7 @@ async function timeout(ms) {
|
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
// src/utils/uniqueName.ts
|
|
329
|
-
|
|
331
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
330
332
|
function getUniqueName(originalName, data) {
|
|
331
333
|
let used = data[originalName] || 0;
|
|
332
334
|
if (used) {
|
|
@@ -347,9 +349,9 @@ function setUniqueName(originalName, data) {
|
|
|
347
349
|
}
|
|
348
350
|
|
|
349
351
|
// src/utils/URLPath.ts
|
|
350
|
-
|
|
352
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
351
353
|
var URLPath = class {
|
|
352
|
-
|
|
354
|
+
path;
|
|
353
355
|
constructor(path) {
|
|
354
356
|
this.path = path;
|
|
355
357
|
return this;
|
|
@@ -364,7 +366,7 @@ var URLPath = class {
|
|
|
364
366
|
get isURL() {
|
|
365
367
|
try {
|
|
366
368
|
const url = new URL(this.path);
|
|
367
|
-
if (
|
|
369
|
+
if (url?.href) {
|
|
368
370
|
return true;
|
|
369
371
|
}
|
|
370
372
|
} catch (error) {
|
|
@@ -415,7 +417,7 @@ var URLPath = class {
|
|
|
415
417
|
let newPath = this.path.replaceAll("{", "${");
|
|
416
418
|
if (found) {
|
|
417
419
|
newPath = found.reduce((prev, curr) => {
|
|
418
|
-
const pathParam = replacer ? replacer(
|
|
420
|
+
const pathParam = replacer ? replacer(chunkHMCSWG5L_cjs.camelCase(curr)) : chunkHMCSWG5L_cjs.camelCase(curr);
|
|
419
421
|
const replacement = `\${${pathParam}}`;
|
|
420
422
|
return prev.replace(curr, replacement);
|
|
421
423
|
}, this.path);
|
|
@@ -431,7 +433,7 @@ var URLPath = class {
|
|
|
431
433
|
const params = {};
|
|
432
434
|
found.forEach((item) => {
|
|
433
435
|
item = item.replaceAll("{", "").replaceAll("}", "");
|
|
434
|
-
const pathParam = replacer ? replacer(
|
|
436
|
+
const pathParam = replacer ? replacer(chunkHMCSWG5L_cjs.camelCase(item)) : chunkHMCSWG5L_cjs.camelCase(item);
|
|
435
437
|
params[pathParam] = pathParam;
|
|
436
438
|
}, this.path);
|
|
437
439
|
return params;
|
|
@@ -446,29 +448,22 @@ var URLPath = class {
|
|
|
446
448
|
};
|
|
447
449
|
|
|
448
450
|
// src/utils/parser.ts
|
|
449
|
-
|
|
450
|
-
var _path = require('path');
|
|
451
|
-
var _fs = require('@kubb/fs');
|
|
452
|
-
var _objecthash = require('object-hash'); var _objecthash2 = _interopRequireDefault(_objecthash);
|
|
451
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
453
452
|
|
|
454
453
|
// src/FileManager.ts
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
var _remeda = require('remeda');
|
|
458
|
-
|
|
454
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
459
455
|
|
|
460
456
|
// src/BarrelManager.ts
|
|
461
|
-
|
|
462
|
-
|
|
457
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
463
458
|
|
|
464
459
|
// src/utils/TreeNode.ts
|
|
465
|
-
|
|
466
|
-
var TreeNode =
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
460
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
461
|
+
var TreeNode = class _TreeNode {
|
|
462
|
+
data;
|
|
463
|
+
parent;
|
|
464
|
+
children = [];
|
|
470
465
|
#cachedLeaves = void 0;
|
|
471
|
-
constructor(data, parent) {
|
|
466
|
+
constructor(data, parent) {
|
|
472
467
|
this.data = data;
|
|
473
468
|
this.parent = parent;
|
|
474
469
|
return this;
|
|
@@ -510,7 +505,7 @@ var TreeNode = (_class = class _TreeNode {
|
|
|
510
505
|
callback(this);
|
|
511
506
|
if (this.children) {
|
|
512
507
|
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
513
|
-
|
|
508
|
+
this.children[i]?.forEach(callback);
|
|
514
509
|
}
|
|
515
510
|
}
|
|
516
511
|
return this;
|
|
@@ -558,19 +553,19 @@ var TreeNode = (_class = class _TreeNode {
|
|
|
558
553
|
file: item.file,
|
|
559
554
|
type: FileManager.getMode(item.path)
|
|
560
555
|
});
|
|
561
|
-
if (
|
|
562
|
-
|
|
556
|
+
if (item.children?.length) {
|
|
557
|
+
item.children?.forEach((child) => {
|
|
563
558
|
recurse(subNode, child);
|
|
564
|
-
})
|
|
559
|
+
});
|
|
565
560
|
}
|
|
566
561
|
};
|
|
567
|
-
|
|
562
|
+
filteredTree.children?.forEach((child) => recurse(treeNode, child));
|
|
568
563
|
return treeNode;
|
|
569
564
|
} catch (e) {
|
|
570
565
|
throw new Error("Something went wrong with creating barrel files with the TreeNode class", { cause: e });
|
|
571
566
|
}
|
|
572
567
|
}
|
|
573
|
-
}
|
|
568
|
+
};
|
|
574
569
|
function buildDirectoryTree(files, rootFolder = "") {
|
|
575
570
|
const rootPrefix = rootFolder.endsWith("/") ? rootFolder : `${rootFolder}/`;
|
|
576
571
|
const filteredFiles = files.filter((file) => rootFolder ? file.path.startsWith(rootPrefix) && !file.path.endsWith(".json") : !file.path.endsWith(".json"));
|
|
@@ -617,9 +612,6 @@ function buildDirectoryTree(files, rootFolder = "") {
|
|
|
617
612
|
});
|
|
618
613
|
return root;
|
|
619
614
|
}
|
|
620
|
-
|
|
621
|
-
// src/BarrelManager.ts
|
|
622
|
-
|
|
623
615
|
var BarrelManager = class {
|
|
624
616
|
#options;
|
|
625
617
|
constructor(options = {}) {
|
|
@@ -629,13 +621,13 @@ var BarrelManager = class {
|
|
|
629
621
|
getFiles({ files: generatedFiles, root, meta }) {
|
|
630
622
|
const { logger } = this.#options;
|
|
631
623
|
const cachedFiles = /* @__PURE__ */ new Map();
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
if (!treeNode || !treeNode.children || !
|
|
624
|
+
logger?.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Start barrel generation for pluginKey ${meta?.pluginKey?.join(".")} and root '${root}'`] });
|
|
625
|
+
TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {
|
|
626
|
+
if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {
|
|
635
627
|
return void 0;
|
|
636
628
|
}
|
|
637
629
|
const barrelFile = {
|
|
638
|
-
path:
|
|
630
|
+
path: path.join(treeNode.parent?.data.path, "index.ts"),
|
|
639
631
|
baseName: "index.ts",
|
|
640
632
|
exports: [],
|
|
641
633
|
sources: []
|
|
@@ -646,30 +638,30 @@ var BarrelManager = class {
|
|
|
646
638
|
if (!item.data.name) {
|
|
647
639
|
return void 0;
|
|
648
640
|
}
|
|
649
|
-
const sources =
|
|
641
|
+
const sources = item.data.file?.sources || [];
|
|
650
642
|
if (!sources.some((source) => source.isIndexable)) {
|
|
651
|
-
|
|
643
|
+
logger?.emit(
|
|
652
644
|
"warning",
|
|
653
645
|
`No isIndexable source found(source should have a name and isIndexable):
|
|
654
646
|
File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
655
|
-
)
|
|
647
|
+
);
|
|
656
648
|
}
|
|
657
649
|
sources.forEach((source) => {
|
|
658
|
-
if (!
|
|
650
|
+
if (!item.data.file?.path || !source.isIndexable || !source.name) {
|
|
659
651
|
return void 0;
|
|
660
652
|
}
|
|
661
|
-
const alreadyContainInPreviousBarrelFile =
|
|
653
|
+
const alreadyContainInPreviousBarrelFile = previousBarrelFile?.sources.some((item2) => item2.name === source.name);
|
|
662
654
|
if (alreadyContainInPreviousBarrelFile) {
|
|
663
655
|
return void 0;
|
|
664
656
|
}
|
|
665
657
|
if (!barrelFile.exports) {
|
|
666
658
|
barrelFile.exports = [];
|
|
667
659
|
}
|
|
668
|
-
const isSubExport = !!
|
|
660
|
+
const isSubExport = !!treeNode.parent?.data.path?.split?.("/")?.length;
|
|
669
661
|
if (isSubExport) {
|
|
670
662
|
barrelFile.exports.push({
|
|
671
663
|
name: [source.name],
|
|
672
|
-
path:
|
|
664
|
+
path: fs.getRelativePath(treeNode.parent?.data.path, item.data.path),
|
|
673
665
|
isTypeOnly: source.isTypeOnly
|
|
674
666
|
});
|
|
675
667
|
} else {
|
|
@@ -689,41 +681,38 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
689
681
|
});
|
|
690
682
|
});
|
|
691
683
|
});
|
|
692
|
-
|
|
684
|
+
logger?.emit("debug", {
|
|
693
685
|
date: /* @__PURE__ */ new Date(),
|
|
694
686
|
logs: [
|
|
695
|
-
`Generating barrelFile '${
|
|
687
|
+
`Generating barrelFile '${fs.getRelativePath(root, barrelFile.path)}' for '${fs.getRelativePath(root, treeNode.data?.path)}' with ${barrelFile.sources.length} indexable exports: '${barrelFile.sources?.map((source) => source.name).join(", ")}'`
|
|
696
688
|
]
|
|
697
|
-
})
|
|
698
|
-
|
|
689
|
+
});
|
|
690
|
+
logger?.emit("debug", {
|
|
699
691
|
date: /* @__PURE__ */ new Date(),
|
|
700
692
|
logs: [
|
|
701
|
-
`Generated barrelFile '${
|
|
693
|
+
`Generated barrelFile '${fs.getRelativePath(root, barrelFile.path)}' for '${fs.getRelativePath(root, treeNode.data?.path)}' with exports: '${cachedFiles.get(barrelFile.path)?.sources?.map((source) => source.name).join(", ")}'`
|
|
702
694
|
]
|
|
703
|
-
})
|
|
695
|
+
});
|
|
704
696
|
if (previousBarrelFile) {
|
|
705
697
|
previousBarrelFile.sources.push(...barrelFile.sources);
|
|
706
|
-
|
|
698
|
+
previousBarrelFile.exports?.push(...barrelFile.exports || []);
|
|
707
699
|
} else {
|
|
708
700
|
cachedFiles.set(barrelFile.path, barrelFile);
|
|
709
701
|
}
|
|
710
|
-
})
|
|
702
|
+
});
|
|
711
703
|
return [...cachedFiles.values()];
|
|
712
704
|
}
|
|
713
705
|
};
|
|
714
706
|
|
|
715
|
-
// src/FileManager.ts
|
|
716
|
-
|
|
717
|
-
|
|
718
707
|
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
|
719
|
-
|
|
708
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
720
709
|
|
|
721
710
|
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
|
722
|
-
|
|
723
|
-
var import_index =
|
|
711
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
712
|
+
var import_index = chunkADFKVVPE_cjs.__toESM(require_eventemitter3(), 1);
|
|
724
713
|
|
|
725
714
|
// ../../node_modules/.pnpm/p-timeout@6.1.2/node_modules/p-timeout/index.js
|
|
726
|
-
|
|
715
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
727
716
|
var TimeoutError = class extends Error {
|
|
728
717
|
constructor(message) {
|
|
729
718
|
super(message);
|
|
@@ -785,7 +774,7 @@ function pTimeout(promise, options) {
|
|
|
785
774
|
} else if (message instanceof Error) {
|
|
786
775
|
reject(message);
|
|
787
776
|
} else {
|
|
788
|
-
timeoutError.message =
|
|
777
|
+
timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
|
|
789
778
|
reject(timeoutError);
|
|
790
779
|
}
|
|
791
780
|
}, milliseconds);
|
|
@@ -808,10 +797,10 @@ function pTimeout(promise, options) {
|
|
|
808
797
|
}
|
|
809
798
|
|
|
810
799
|
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
|
|
811
|
-
|
|
800
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
812
801
|
|
|
813
802
|
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/lower-bound.js
|
|
814
|
-
|
|
803
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
815
804
|
function lowerBound(array, value, comparator) {
|
|
816
805
|
let first = 0;
|
|
817
806
|
let count = array.length;
|
|
@@ -849,7 +838,7 @@ var PriorityQueue = class {
|
|
|
849
838
|
}
|
|
850
839
|
dequeue() {
|
|
851
840
|
const item = this.#queue.shift();
|
|
852
|
-
return
|
|
841
|
+
return item?.run;
|
|
853
842
|
}
|
|
854
843
|
filter(options) {
|
|
855
844
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -881,7 +870,7 @@ var PQueue = class extends import_index.default {
|
|
|
881
870
|
|
|
882
871
|
Applies to each future operation.
|
|
883
872
|
*/
|
|
884
|
-
|
|
873
|
+
timeout;
|
|
885
874
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
886
875
|
constructor(options) {
|
|
887
876
|
super();
|
|
@@ -895,10 +884,10 @@ var PQueue = class extends import_index.default {
|
|
|
895
884
|
...options
|
|
896
885
|
};
|
|
897
886
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
898
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${
|
|
887
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${options.intervalCap?.toString() ?? ""}\` (${typeof options.intervalCap})`);
|
|
899
888
|
}
|
|
900
889
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
901
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${
|
|
890
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval?.toString() ?? ""}\` (${typeof options.interval})`);
|
|
902
891
|
}
|
|
903
892
|
this.#carryoverConcurrencyCount = options.carryoverConcurrencyCount;
|
|
904
893
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -1025,7 +1014,7 @@ var PQueue = class extends import_index.default {
|
|
|
1025
1014
|
this.#pending++;
|
|
1026
1015
|
this.#intervalCount++;
|
|
1027
1016
|
try {
|
|
1028
|
-
|
|
1017
|
+
options.signal?.throwIfAborted();
|
|
1029
1018
|
let operation = function_({ signal: options.signal });
|
|
1030
1019
|
if (options.timeout) {
|
|
1031
1020
|
operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
|
|
@@ -1163,11 +1152,11 @@ var FileManager = class {
|
|
|
1163
1152
|
return Array.from(this.#files);
|
|
1164
1153
|
}
|
|
1165
1154
|
get orderedFiles() {
|
|
1166
|
-
return
|
|
1167
|
-
(v) =>
|
|
1155
|
+
return chunkHMCSWG5L_cjs.orderBy(Array.from(this.#files), [
|
|
1156
|
+
(v) => v?.meta && "pluginKey" in v.meta && !v.meta.pluginKey,
|
|
1168
1157
|
(v) => v.path.length,
|
|
1169
|
-
(v) =>
|
|
1170
|
-
(v) =>
|
|
1158
|
+
(v) => fs.trimExtName(v.path).endsWith("index"),
|
|
1159
|
+
(v) => fs.trimExtName(v.baseName),
|
|
1171
1160
|
(v) => v.path.split(".").pop()
|
|
1172
1161
|
]);
|
|
1173
1162
|
}
|
|
@@ -1235,9 +1224,9 @@ var FileManager = class {
|
|
|
1235
1224
|
if (exportType === false) {
|
|
1236
1225
|
return [];
|
|
1237
1226
|
}
|
|
1238
|
-
const pathToBuildFrom =
|
|
1239
|
-
if (
|
|
1240
|
-
|
|
1227
|
+
const pathToBuildFrom = path.join(root, output.path);
|
|
1228
|
+
if (fs.trimExtName(pathToBuildFrom).endsWith("index")) {
|
|
1229
|
+
logger?.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
|
|
1241
1230
|
return [];
|
|
1242
1231
|
}
|
|
1243
1232
|
const barrelFiles = barrelManager.getFiles({ files, root: pathToBuildFrom, meta });
|
|
@@ -1245,12 +1234,12 @@ var FileManager = class {
|
|
|
1245
1234
|
return barrelFiles.map((file) => {
|
|
1246
1235
|
return {
|
|
1247
1236
|
...file,
|
|
1248
|
-
exports:
|
|
1237
|
+
exports: file.exports?.map((exportItem) => {
|
|
1249
1238
|
return {
|
|
1250
1239
|
...exportItem,
|
|
1251
1240
|
name: void 0
|
|
1252
1241
|
};
|
|
1253
|
-
})
|
|
1242
|
+
})
|
|
1254
1243
|
};
|
|
1255
1244
|
});
|
|
1256
1245
|
}
|
|
@@ -1262,17 +1251,17 @@ var FileManager = class {
|
|
|
1262
1251
|
});
|
|
1263
1252
|
}
|
|
1264
1253
|
async write(...params) {
|
|
1265
|
-
return
|
|
1254
|
+
return fs.write(...params);
|
|
1266
1255
|
}
|
|
1267
1256
|
async read(...params) {
|
|
1268
|
-
return
|
|
1257
|
+
return fs.read(...params);
|
|
1269
1258
|
}
|
|
1270
1259
|
// statics
|
|
1271
|
-
static getMode(path) {
|
|
1272
|
-
if (!path) {
|
|
1260
|
+
static getMode(path$1) {
|
|
1261
|
+
if (!path$1) {
|
|
1273
1262
|
return "split";
|
|
1274
1263
|
}
|
|
1275
|
-
return
|
|
1264
|
+
return path.extname(path$1) ? "single" : "split";
|
|
1276
1265
|
}
|
|
1277
1266
|
};
|
|
1278
1267
|
async function getSource(file, { logger } = {}) {
|
|
@@ -1312,14 +1301,14 @@ function combineExports(exports) {
|
|
|
1312
1301
|
(prev, curr) => {
|
|
1313
1302
|
const name = curr.name;
|
|
1314
1303
|
const prevByPath = prev.findLast((imp) => imp.path === curr.path);
|
|
1315
|
-
const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path &&
|
|
1304
|
+
const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && remeda.isDeepEqual(imp.name, name) && imp.isTypeOnly);
|
|
1316
1305
|
if (prevByPathAndIsTypeOnly) {
|
|
1317
1306
|
return prev;
|
|
1318
1307
|
}
|
|
1319
1308
|
const uniquePrev = prev.findLast(
|
|
1320
|
-
(imp) => imp.path === curr.path &&
|
|
1309
|
+
(imp) => imp.path === curr.path && remeda.isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
|
|
1321
1310
|
);
|
|
1322
|
-
if (uniquePrev || Array.isArray(name) && !name.length ||
|
|
1311
|
+
if (uniquePrev || Array.isArray(name) && !name.length || prevByPath?.asAlias && !curr.asAlias) {
|
|
1323
1312
|
return prev;
|
|
1324
1313
|
}
|
|
1325
1314
|
if (!prevByPath) {
|
|
@@ -1339,12 +1328,12 @@ function combineExports(exports) {
|
|
|
1339
1328
|
},
|
|
1340
1329
|
[]
|
|
1341
1330
|
);
|
|
1342
|
-
return
|
|
1331
|
+
return chunkHMCSWG5L_cjs.orderBy(combinedExports, [
|
|
1343
1332
|
(v) => !!Array.isArray(v.name),
|
|
1344
1333
|
(v) => !v.isTypeOnly,
|
|
1345
1334
|
(v) => v.path,
|
|
1346
1335
|
(v) => !!v.name,
|
|
1347
|
-
(v) => Array.isArray(v.name) ?
|
|
1336
|
+
(v) => Array.isArray(v.name) ? chunkHMCSWG5L_cjs.orderBy(v.name) : v.name
|
|
1348
1337
|
]);
|
|
1349
1338
|
}
|
|
1350
1339
|
function combineImports(imports, exports, source) {
|
|
@@ -1365,8 +1354,8 @@ function combineImports(imports, exports, source) {
|
|
|
1365
1354
|
name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
|
|
1366
1355
|
}
|
|
1367
1356
|
const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
|
|
1368
|
-
const uniquePrev = prev.findLast((imp) => imp.path === curr.path &&
|
|
1369
|
-
const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path &&
|
|
1357
|
+
const uniquePrev = prev.findLast((imp) => imp.path === curr.path && remeda.isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
|
|
1358
|
+
const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && remeda.isDeepEqual(imp.name, name) && imp.isTypeOnly);
|
|
1370
1359
|
if (prevByPathNameAndIsTypeOnly) {
|
|
1371
1360
|
return prev;
|
|
1372
1361
|
}
|
|
@@ -1393,20 +1382,20 @@ function combineImports(imports, exports, source) {
|
|
|
1393
1382
|
},
|
|
1394
1383
|
[]
|
|
1395
1384
|
);
|
|
1396
|
-
return
|
|
1385
|
+
return chunkHMCSWG5L_cjs.orderBy(combinedImports, [
|
|
1397
1386
|
(v) => !!Array.isArray(v.name),
|
|
1398
1387
|
(v) => !v.isTypeOnly,
|
|
1399
1388
|
(v) => v.path,
|
|
1400
1389
|
(v) => !!v.name,
|
|
1401
|
-
(v) => Array.isArray(v.name) ?
|
|
1390
|
+
(v) => Array.isArray(v.name) ? chunkHMCSWG5L_cjs.orderBy(v.name) : v.name
|
|
1402
1391
|
]);
|
|
1403
1392
|
}
|
|
1404
1393
|
var queue = new PQueue({ concurrency: 100 });
|
|
1405
1394
|
async function processFiles({ dryRun, config, logger, files }) {
|
|
1406
|
-
const orderedFiles =
|
|
1407
|
-
(v) =>
|
|
1395
|
+
const orderedFiles = chunkHMCSWG5L_cjs.orderBy(files, [
|
|
1396
|
+
(v) => v?.meta && "pluginKey" in v.meta && !v.meta.pluginKey,
|
|
1408
1397
|
(v) => v.path.length,
|
|
1409
|
-
(v) =>
|
|
1398
|
+
(v) => fs.trimExtName(v.path).endsWith("index")
|
|
1410
1399
|
]);
|
|
1411
1400
|
logger.emit("debug", {
|
|
1412
1401
|
date: /* @__PURE__ */ new Date(),
|
|
@@ -1418,9 +1407,9 @@ async function processFiles({ dryRun, config, logger, files }) {
|
|
|
1418
1407
|
logger.emit("progress_start", { id: "files", size, message: "Writing files ..." });
|
|
1419
1408
|
const promises = orderedFiles.map(async (file) => {
|
|
1420
1409
|
await queue.add(async () => {
|
|
1421
|
-
const message = file ? `Writing ${
|
|
1410
|
+
const message = file ? `Writing ${path.relative(config.root, file.path)}` : "";
|
|
1422
1411
|
const source = await getSource(file, { logger });
|
|
1423
|
-
await
|
|
1412
|
+
await fs.write(file.path, source, { sanity: false });
|
|
1424
1413
|
logger.emit("progressed", { id: "files", message });
|
|
1425
1414
|
});
|
|
1426
1415
|
});
|
|
@@ -1432,7 +1421,7 @@ async function processFiles({ dryRun, config, logger, files }) {
|
|
|
1432
1421
|
|
|
1433
1422
|
// src/utils/parser.ts
|
|
1434
1423
|
function createFile(file) {
|
|
1435
|
-
const extName =
|
|
1424
|
+
const extName = path.extname(file.baseName);
|
|
1436
1425
|
if (!extName) {
|
|
1437
1426
|
throw new Error(`No extName found for ${file.baseName}`);
|
|
1438
1427
|
}
|
|
@@ -1442,7 +1431,7 @@ function createFile(file) {
|
|
|
1442
1431
|
const sources = file.sources ? combineSources(file.sources) : [];
|
|
1443
1432
|
return {
|
|
1444
1433
|
...file,
|
|
1445
|
-
id:
|
|
1434
|
+
id: hash__default.default({ path: file.path }),
|
|
1446
1435
|
name: trimExtName2(file.baseName),
|
|
1447
1436
|
extName,
|
|
1448
1437
|
imports: imports.map((item) => createFileImport(item)),
|
|
@@ -1454,14 +1443,14 @@ function createFileSource(source) {
|
|
|
1454
1443
|
return source;
|
|
1455
1444
|
}
|
|
1456
1445
|
function createFileImport(imp) {
|
|
1457
|
-
const extName =
|
|
1446
|
+
const extName = path.extname(imp.path);
|
|
1458
1447
|
return {
|
|
1459
1448
|
...imp,
|
|
1460
1449
|
extName: imp.extName ? imp.extName : extName
|
|
1461
1450
|
};
|
|
1462
1451
|
}
|
|
1463
1452
|
function createFileExport(exp) {
|
|
1464
|
-
const extName =
|
|
1453
|
+
const extName = path.extname(exp.path);
|
|
1465
1454
|
return {
|
|
1466
1455
|
...exp,
|
|
1467
1456
|
extName: exp.extName ? exp.extName : extName
|
|
@@ -1475,9 +1464,9 @@ var typeScriptParser = createFileParser({
|
|
|
1475
1464
|
return void 0;
|
|
1476
1465
|
},
|
|
1477
1466
|
async print(file) {
|
|
1478
|
-
const module = await
|
|
1467
|
+
const module = await import('@kubb/parser-ts');
|
|
1479
1468
|
const importNodes = file.imports.map((item) => {
|
|
1480
|
-
const path = item.root ?
|
|
1469
|
+
const path = item.root ? fs.getRelativePath(item.root, item.path) : item.path;
|
|
1481
1470
|
return module.factory.createImportDeclaration({
|
|
1482
1471
|
name: item.name,
|
|
1483
1472
|
path,
|
|
@@ -1526,23 +1515,22 @@ function trimExtName2(text) {
|
|
|
1526
1515
|
return text.replace(`.${extName}`, "");
|
|
1527
1516
|
}
|
|
1528
1517
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
//# sourceMappingURL=chunk-NB4JMN75.cjs.map
|
|
1518
|
+
exports.FileManager = FileManager;
|
|
1519
|
+
exports.FunctionParams = FunctionParams;
|
|
1520
|
+
exports.URLPath = URLPath;
|
|
1521
|
+
exports.createFile = createFile;
|
|
1522
|
+
exports.createFileExport = createFileExport;
|
|
1523
|
+
exports.createFileImport = createFileImport;
|
|
1524
|
+
exports.createFileParser = createFileParser;
|
|
1525
|
+
exports.getFileParser = getFileParser;
|
|
1526
|
+
exports.getSource = getSource;
|
|
1527
|
+
exports.getUniqueName = getUniqueName;
|
|
1528
|
+
exports.isPromise = isPromise;
|
|
1529
|
+
exports.isPromiseFulfilledResult = isPromiseFulfilledResult;
|
|
1530
|
+
exports.isPromiseRejectedResult = isPromiseRejectedResult;
|
|
1531
|
+
exports.processFiles = processFiles;
|
|
1532
|
+
exports.renderTemplate = renderTemplate;
|
|
1533
|
+
exports.setUniqueName = setUniqueName;
|
|
1534
|
+
exports.timeout = timeout;
|
|
1535
|
+
//# sourceMappingURL=chunk-52WA2JF5.cjs.map
|
|
1536
|
+
//# sourceMappingURL=chunk-52WA2JF5.cjs.map
|