@kubb/core 3.4.5 → 3.5.1
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/{FileManager-CODtuwOW.d.cts → FileManager-BxDiClvd.d.cts} +5 -5
- package/dist/{FileManager-BXCK_2OY.d.ts → FileManager-VhW4B9yd.d.ts} +5 -5
- package/dist/{chunk-3CLNO5VR.js → chunk-E2WLQU27.js} +234 -26
- package/dist/chunk-E2WLQU27.js.map +1 -0
- package/dist/{chunk-LVELAYV4.cjs → chunk-NQBPIAF4.cjs} +4 -4
- package/dist/{chunk-LVELAYV4.cjs.map → chunk-NQBPIAF4.cjs.map} +1 -1
- package/dist/{chunk-GTR42WIS.js → chunk-O5ASNFB7.js} +4 -4
- package/dist/chunk-O5ASNFB7.js.map +1 -0
- package/dist/{chunk-HPTZVWK5.cjs → chunk-R4P3J4TG.cjs} +19 -19
- package/dist/chunk-R4P3J4TG.cjs.map +1 -0
- package/dist/{chunk-4SHSEMU2.cjs → chunk-VMPADUCV.cjs} +35 -35
- package/dist/{chunk-4SHSEMU2.cjs.map → chunk-VMPADUCV.cjs.map} +1 -1
- package/dist/{chunk-S3IJRQEO.cjs → chunk-WSUPUMYM.cjs} +255 -39
- package/dist/chunk-WSUPUMYM.cjs.map +1 -0
- package/dist/{chunk-SX3K2Q5X.js → chunk-YYMV5PIX.js} +3 -3
- package/dist/{chunk-SX3K2Q5X.js.map → chunk-YYMV5PIX.js.map} +1 -1
- package/dist/index.cjs +74 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +42 -26
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +6 -7
- package/dist/logger.js +1 -2
- package/dist/mocks.cjs +11 -11
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +4 -4
- package/dist/mocks.js.map +1 -1
- package/dist/prompt-JRPIEHU3.cjs +762 -0
- package/dist/prompt-JRPIEHU3.cjs.map +1 -0
- package/dist/prompt-RQXXVSD5.js +751 -0
- package/dist/prompt-RQXXVSD5.js.map +1 -0
- package/dist/transformers.cjs +22 -22
- package/dist/transformers.js +1 -1
- package/dist/utils.cjs +17 -17
- package/dist/utils.js +2 -2
- package/package.json +8 -8
- package/src/build.ts +42 -24
- package/src/config.ts +1 -1
- package/src/transformers/casing.ts +2 -2
- package/src/types.ts +4 -4
- package/dist/chunk-3CLNO5VR.js.map +0 -1
- package/dist/chunk-GTR42WIS.js.map +0 -1
- package/dist/chunk-HPTZVWK5.cjs.map +0 -1
- package/dist/chunk-OL5US75J.js +0 -208
- package/dist/chunk-OL5US75J.js.map +0 -1
- package/dist/chunk-OQSYTQLS.cjs +0 -236
- package/dist/chunk-OQSYTQLS.cjs.map +0 -1
- package/dist/chunk-S3IJRQEO.cjs.map +0 -1
- package/dist/prompt-CV2GMUO3.cjs +0 -860
- package/dist/prompt-CV2GMUO3.cjs.map +0 -1
- package/dist/prompt-Y6ROOH2L.js +0 -848
- package/dist/prompt-Y6ROOH2L.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
var chunkLVELAYV4_cjs = require('./chunk-LVELAYV4.cjs');
|
|
5
|
+
var chunkWSUPUMYM_cjs = require('./chunk-WSUPUMYM.cjs');
|
|
6
|
+
var chunkVMPADUCV_cjs = require('./chunk-VMPADUCV.cjs');
|
|
7
|
+
var chunkR4P3J4TG_cjs = require('./chunk-R4P3J4TG.cjs');
|
|
8
|
+
var chunkNQBPIAF4_cjs = require('./chunk-NQBPIAF4.cjs');
|
|
10
9
|
var fs = require('@kubb/fs');
|
|
11
10
|
var path3 = require('path');
|
|
12
11
|
var mod = require('module');
|
|
13
12
|
var os = require('os');
|
|
14
13
|
var url = require('url');
|
|
15
|
-
var
|
|
14
|
+
var process2 = require('process');
|
|
16
15
|
var fs$1 = require('fs');
|
|
17
16
|
var semver = require('semver');
|
|
18
17
|
|
|
@@ -21,23 +20,23 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
21
20
|
var path3__default = /*#__PURE__*/_interopDefault(path3);
|
|
22
21
|
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
23
22
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
24
|
-
var
|
|
23
|
+
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
25
24
|
var fs__default = /*#__PURE__*/_interopDefault(fs$1);
|
|
26
25
|
|
|
27
26
|
// src/index.ts
|
|
28
|
-
|
|
27
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
29
28
|
|
|
30
29
|
// src/build.ts
|
|
31
|
-
|
|
30
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
32
31
|
|
|
33
32
|
// src/PluginManager.ts
|
|
34
|
-
|
|
33
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
35
34
|
|
|
36
35
|
// src/PromiseManager.ts
|
|
37
|
-
|
|
36
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
38
37
|
|
|
39
38
|
// src/utils/executeStrategies.ts
|
|
40
|
-
|
|
39
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
41
40
|
function hookSeq(promises) {
|
|
42
41
|
return promises.filter(Boolean).reduce(
|
|
43
42
|
(promise, func) => {
|
|
@@ -99,12 +98,12 @@ function isPromiseRejectedResult(result) {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
// src/errors.ts
|
|
102
|
-
|
|
101
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
103
102
|
var ValidationPluginError = class extends Error {
|
|
104
103
|
};
|
|
105
104
|
|
|
106
105
|
// src/plugin.ts
|
|
107
|
-
|
|
106
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
108
107
|
function createPlugin(factory) {
|
|
109
108
|
return (options = {}) => {
|
|
110
109
|
return factory(options);
|
|
@@ -155,7 +154,7 @@ var pluginCore = createPlugin((options) => {
|
|
|
155
154
|
var PluginManager = class {
|
|
156
155
|
plugins = /* @__PURE__ */ new Set();
|
|
157
156
|
fileManager;
|
|
158
|
-
events = new
|
|
157
|
+
events = new chunkWSUPUMYM_cjs.EventEmitter();
|
|
159
158
|
config;
|
|
160
159
|
executed = [];
|
|
161
160
|
logger;
|
|
@@ -167,7 +166,7 @@ var PluginManager = class {
|
|
|
167
166
|
this.config = config;
|
|
168
167
|
this.options = options;
|
|
169
168
|
this.logger = options.logger;
|
|
170
|
-
this.fileManager = new
|
|
169
|
+
this.fileManager = new chunkVMPADUCV_cjs.FileManager();
|
|
171
170
|
this.#promiseManager = new PromiseManager({
|
|
172
171
|
nullCheck: (state) => !!state?.result
|
|
173
172
|
});
|
|
@@ -243,7 +242,7 @@ Falling back on the first item.
|
|
|
243
242
|
const names = this.hookForPluginSync({
|
|
244
243
|
pluginKey: params.pluginKey,
|
|
245
244
|
hookName: "resolveName",
|
|
246
|
-
parameters: [
|
|
245
|
+
parameters: [chunkR4P3J4TG_cjs.trim(params.name), params.type],
|
|
247
246
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
248
247
|
});
|
|
249
248
|
if (names && names?.length > 1) {
|
|
@@ -259,14 +258,14 @@ Falling back on the first item.
|
|
|
259
258
|
]
|
|
260
259
|
});
|
|
261
260
|
}
|
|
262
|
-
return
|
|
261
|
+
return chunkR4P3J4TG_cjs.transformReservedWord(names?.at(0) || params.name);
|
|
263
262
|
}
|
|
264
263
|
const name = this.hookFirstSync({
|
|
265
264
|
hookName: "resolveName",
|
|
266
|
-
parameters: [
|
|
265
|
+
parameters: [chunkR4P3J4TG_cjs.trim(params.name), params.type],
|
|
267
266
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
268
267
|
}).result;
|
|
269
|
-
return
|
|
268
|
+
return chunkR4P3J4TG_cjs.transformReservedWord(name);
|
|
270
269
|
};
|
|
271
270
|
/**
|
|
272
271
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -596,7 +595,7 @@ Falling back on the first item.
|
|
|
596
595
|
}
|
|
597
596
|
#parse(plugin, pluginManager, context) {
|
|
598
597
|
const usedPluginNames = pluginManager.#usedPluginNames;
|
|
599
|
-
|
|
598
|
+
chunkVMPADUCV_cjs.setUniqueName(plugin.name, usedPluginNames);
|
|
600
599
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
601
600
|
if (plugin.context && typeof plugin.context === "function") {
|
|
602
601
|
return {
|
|
@@ -631,7 +630,7 @@ Falling back on the first item.
|
|
|
631
630
|
};
|
|
632
631
|
|
|
633
632
|
// src/config.ts
|
|
634
|
-
|
|
633
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
635
634
|
function defineConfig(options) {
|
|
636
635
|
return options;
|
|
637
636
|
}
|
|
@@ -639,23 +638,39 @@ function isInputPath(result) {
|
|
|
639
638
|
return !!result && "path" in result?.input;
|
|
640
639
|
}
|
|
641
640
|
async function setup(options) {
|
|
642
|
-
const { config, logger =
|
|
641
|
+
const { config: userConfig, logger = chunkWSUPUMYM_cjs.createLogger() } = options;
|
|
643
642
|
try {
|
|
644
|
-
if (isInputPath(
|
|
645
|
-
await fs.read(
|
|
643
|
+
if (isInputPath(userConfig) && !new chunkVMPADUCV_cjs.URLPath(userConfig.input.path).isURL) {
|
|
644
|
+
await fs.read(userConfig.input.path);
|
|
646
645
|
}
|
|
647
646
|
} catch (e) {
|
|
648
|
-
if (isInputPath(
|
|
649
|
-
throw new Error(
|
|
650
|
-
|
|
651
|
-
|
|
647
|
+
if (isInputPath(userConfig)) {
|
|
648
|
+
throw new Error(
|
|
649
|
+
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${userConfig.input.path}`,
|
|
650
|
+
{
|
|
651
|
+
cause: e
|
|
652
|
+
}
|
|
653
|
+
);
|
|
652
654
|
}
|
|
653
655
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
656
|
+
const definedConfig = {
|
|
657
|
+
root: userConfig.root || process.cwd(),
|
|
658
|
+
...userConfig,
|
|
659
|
+
output: {
|
|
660
|
+
write: true,
|
|
661
|
+
barrelType: "named",
|
|
662
|
+
extension: {
|
|
663
|
+
".ts": ".ts"
|
|
664
|
+
},
|
|
665
|
+
...userConfig.output
|
|
666
|
+
},
|
|
667
|
+
plugins: userConfig.plugins
|
|
668
|
+
};
|
|
669
|
+
if (definedConfig.output.clean) {
|
|
670
|
+
await fs.clean(definedConfig.output.path);
|
|
671
|
+
await fs.clean(path3.join(definedConfig.root, ".kubb"));
|
|
657
672
|
}
|
|
658
|
-
return new PluginManager(
|
|
673
|
+
return new PluginManager(definedConfig, { logger });
|
|
659
674
|
}
|
|
660
675
|
async function build(options) {
|
|
661
676
|
const { files, pluginManager, error } = await safeBuild(options);
|
|
@@ -669,6 +684,7 @@ async function build(options) {
|
|
|
669
684
|
async function safeBuild(options) {
|
|
670
685
|
let files = [];
|
|
671
686
|
const pluginManager = await setup(options);
|
|
687
|
+
const config = pluginManager.config;
|
|
672
688
|
try {
|
|
673
689
|
pluginManager.events.on("executing", ({ plugin, message }) => {
|
|
674
690
|
pluginManager.logger.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Executing pluginKey ${plugin.key?.join(".")} | ${message}`] });
|
|
@@ -681,11 +697,11 @@ async function safeBuild(options) {
|
|
|
681
697
|
});
|
|
682
698
|
await pluginManager.hookParallel({
|
|
683
699
|
hookName: "buildStart",
|
|
684
|
-
parameters: [
|
|
700
|
+
parameters: [config],
|
|
685
701
|
message: "buildStart"
|
|
686
702
|
});
|
|
687
|
-
const root = path3.resolve(
|
|
688
|
-
const rootPath = path3.resolve(root,
|
|
703
|
+
const root = path3.resolve(config.root);
|
|
704
|
+
const rootPath = path3.resolve(root, config.output.path, "index.ts");
|
|
689
705
|
const barrelFiles = pluginManager.fileManager.files.filter((file) => {
|
|
690
706
|
return file.sources.some((source) => source.isIndexable);
|
|
691
707
|
});
|
|
@@ -707,26 +723,26 @@ async function safeBuild(options) {
|
|
|
707
723
|
return void 0;
|
|
708
724
|
}
|
|
709
725
|
return {
|
|
710
|
-
name:
|
|
726
|
+
name: config.output.barrelType === "all" ? void 0 : [source.name],
|
|
711
727
|
path: fs.getRelativePath(rootPath, file.path),
|
|
712
|
-
isTypeOnly:
|
|
728
|
+
isTypeOnly: config.output.barrelType === "all" ? containsOnlyTypes : source.isTypeOnly
|
|
713
729
|
};
|
|
714
730
|
}).filter(Boolean);
|
|
715
731
|
}).filter(Boolean),
|
|
716
732
|
sources: [],
|
|
717
733
|
meta: {}
|
|
718
734
|
};
|
|
719
|
-
if (
|
|
735
|
+
if (config.output.barrelType) {
|
|
720
736
|
await pluginManager.fileManager.add(rootFile);
|
|
721
737
|
}
|
|
722
|
-
files = await
|
|
723
|
-
root:
|
|
724
|
-
extension:
|
|
725
|
-
dryRun: !
|
|
738
|
+
files = await chunkVMPADUCV_cjs.processFiles({
|
|
739
|
+
root: config.root,
|
|
740
|
+
extension: config.output.extension,
|
|
741
|
+
dryRun: !config.output.write,
|
|
726
742
|
files: pluginManager.fileManager.files,
|
|
727
743
|
logger: pluginManager.logger
|
|
728
744
|
});
|
|
729
|
-
await pluginManager.hookParallel({ hookName: "buildEnd", message: `Build stopped for ${
|
|
745
|
+
await pluginManager.hookParallel({ hookName: "buildEnd", message: `Build stopped for ${config.name}` });
|
|
730
746
|
pluginManager.fileManager.clear();
|
|
731
747
|
} catch (e) {
|
|
732
748
|
return {
|
|
@@ -742,7 +758,7 @@ async function safeBuild(options) {
|
|
|
742
758
|
}
|
|
743
759
|
|
|
744
760
|
// src/BaseGenerator.ts
|
|
745
|
-
|
|
761
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
746
762
|
var BaseGenerator = class {
|
|
747
763
|
#options = {};
|
|
748
764
|
#context = {};
|
|
@@ -767,22 +783,22 @@ var BaseGenerator = class {
|
|
|
767
783
|
};
|
|
768
784
|
|
|
769
785
|
// src/PackageManager.ts
|
|
770
|
-
|
|
786
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
771
787
|
|
|
772
788
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
773
|
-
|
|
789
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
774
790
|
|
|
775
791
|
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
776
|
-
|
|
792
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
777
793
|
|
|
778
794
|
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
779
|
-
|
|
795
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
780
796
|
|
|
781
797
|
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
782
|
-
|
|
798
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
783
799
|
|
|
784
800
|
// ../../node_modules/.pnpm/yocto-queue@1.1.1/node_modules/yocto-queue/index.js
|
|
785
|
-
|
|
801
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
786
802
|
var Node = class {
|
|
787
803
|
value;
|
|
788
804
|
next;
|
|
@@ -937,7 +953,7 @@ function checkType(type) {
|
|
|
937
953
|
var matchType = (type, stat) => stat[typeMappings[type]]();
|
|
938
954
|
var toPath = (urlOrPath) => urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
939
955
|
async function locatePath(paths, {
|
|
940
|
-
cwd =
|
|
956
|
+
cwd = process2__default.default.cwd(),
|
|
941
957
|
type = "file",
|
|
942
958
|
allowSymlinks = true,
|
|
943
959
|
concurrency,
|
|
@@ -956,7 +972,7 @@ async function locatePath(paths, {
|
|
|
956
972
|
}, { concurrency, preserveOrder });
|
|
957
973
|
}
|
|
958
974
|
function locatePathSync(paths, {
|
|
959
|
-
cwd =
|
|
975
|
+
cwd = process2__default.default.cwd(),
|
|
960
976
|
type = "file",
|
|
961
977
|
allowSymlinks = true
|
|
962
978
|
} = {}) {
|
|
@@ -980,13 +996,13 @@ function locatePathSync(paths, {
|
|
|
980
996
|
}
|
|
981
997
|
|
|
982
998
|
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
983
|
-
|
|
999
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
984
1000
|
function toPath2(urlOrPath) {
|
|
985
1001
|
return urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
986
1002
|
}
|
|
987
1003
|
|
|
988
1004
|
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
989
|
-
|
|
1005
|
+
chunkNQBPIAF4_cjs.init_cjs_shims();
|
|
990
1006
|
|
|
991
1007
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
992
1008
|
var findUpStop = Symbol("findUpStop");
|
|
@@ -1188,15 +1204,15 @@ var PackageManager = class _PackageManager {
|
|
|
1188
1204
|
|
|
1189
1205
|
Object.defineProperty(exports, "FileManager", {
|
|
1190
1206
|
enumerable: true,
|
|
1191
|
-
get: function () { return
|
|
1207
|
+
get: function () { return chunkVMPADUCV_cjs.FileManager; }
|
|
1192
1208
|
});
|
|
1193
1209
|
Object.defineProperty(exports, "getSource", {
|
|
1194
1210
|
enumerable: true,
|
|
1195
|
-
get: function () { return
|
|
1211
|
+
get: function () { return chunkVMPADUCV_cjs.getSource; }
|
|
1196
1212
|
});
|
|
1197
1213
|
Object.defineProperty(exports, "processFiles", {
|
|
1198
1214
|
enumerable: true,
|
|
1199
|
-
get: function () { return
|
|
1215
|
+
get: function () { return chunkVMPADUCV_cjs.processFiles; }
|
|
1200
1216
|
});
|
|
1201
1217
|
exports.BaseGenerator = BaseGenerator;
|
|
1202
1218
|
exports.PackageManager = PackageManager;
|