@kubb/core 3.0.0-alpha.11 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/{FileManager-CpuFz6eH.d.ts → FileManager-B-fP5y5O.d.ts} +5 -10
- package/dist/{FileManager-BbUCeEyv.d.cts → FileManager-CL52wQgR.d.cts} +5 -10
- package/dist/{chunk-HMCSWG5L.cjs → chunk-2ESEP5LA.cjs} +9 -9
- package/dist/chunk-2ESEP5LA.cjs.map +1 -0
- package/dist/{chunk-YEVCYV36.cjs → chunk-DU3QBH4U.cjs} +10 -10
- package/dist/{chunk-YEVCYV36.cjs.map → chunk-DU3QBH4U.cjs.map} +1 -1
- package/dist/{chunk-TTDCUWK7.cjs → chunk-NDHS47GW.cjs} +4 -4
- package/dist/{chunk-TTDCUWK7.cjs.map → chunk-NDHS47GW.cjs.map} +1 -1
- package/dist/{chunk-52WA2JF5.cjs → chunk-Q2VSIEFB.cjs} +71 -68
- package/dist/chunk-Q2VSIEFB.cjs.map +1 -0
- package/dist/{chunk-PJLUPV3P.cjs → chunk-UTH63P4L.cjs} +8 -8
- package/dist/{chunk-PJLUPV3P.cjs.map → chunk-UTH63P4L.cjs.map} +1 -1
- package/dist/{chunk-ADFKVVPE.cjs → chunk-WG3GHGN2.cjs} +4 -4
- package/dist/{chunk-ADFKVVPE.cjs.map → chunk-WG3GHGN2.cjs.map} +1 -1
- package/dist/{chunk-L6YLVCKM.js → chunk-ZWL7JIMH.js} +42 -42
- package/dist/chunk-ZWL7JIMH.js.map +1 -0
- package/dist/index.cjs +54 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -42
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +7 -7
- package/dist/mocks.cjs +8 -8
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/dist/{prompt-L5KFKY73.cjs → prompt-R4OORXA5.cjs} +62 -62
- package/dist/{prompt-L5KFKY73.cjs.map → prompt-R4OORXA5.cjs.map} +1 -1
- package/dist/transformers.cjs +23 -23
- package/dist/utils.cjs +17 -17
- package/dist/utils.d.cts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -1
- package/package.json +7 -7
- package/src/BarrelManager.ts +1 -1
- package/src/FileManager.ts +31 -40
- package/src/PluginManager.ts +7 -8
- package/src/build.ts +1 -1
- package/src/index.ts +1 -1
- package/src/plugin.ts +0 -3
- package/src/types.ts +0 -2
- package/src/utils/parser.ts +12 -4
- package/dist/chunk-52WA2JF5.cjs.map +0 -1
- package/dist/chunk-HMCSWG5L.cjs.map +0 -1
- package/dist/chunk-L6YLVCKM.js.map +0 -1
- package/src/utils/cache.ts +0 -35
package/dist/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
var
|
|
5
|
+
var chunkNDHS47GW_cjs = require('./chunk-NDHS47GW.cjs');
|
|
6
|
+
var chunkDU3QBH4U_cjs = require('./chunk-DU3QBH4U.cjs');
|
|
7
|
+
var chunkQ2VSIEFB_cjs = require('./chunk-Q2VSIEFB.cjs');
|
|
8
|
+
require('./chunk-2ESEP5LA.cjs');
|
|
9
|
+
require('./chunk-UTH63P4L.cjs');
|
|
10
|
+
var chunkWG3GHGN2_cjs = require('./chunk-WG3GHGN2.cjs');
|
|
11
11
|
var fs = require('@kubb/fs');
|
|
12
12
|
var path3 = require('path');
|
|
13
13
|
var mod = require('module');
|
|
@@ -26,19 +26,19 @@ var process__default = /*#__PURE__*/_interopDefault(process);
|
|
|
26
26
|
var fs__default = /*#__PURE__*/_interopDefault(fs$1);
|
|
27
27
|
|
|
28
28
|
// src/index.ts
|
|
29
|
-
|
|
29
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
30
30
|
|
|
31
31
|
// src/build.ts
|
|
32
|
-
|
|
32
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
33
33
|
|
|
34
34
|
// src/PluginManager.ts
|
|
35
|
-
|
|
35
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
36
36
|
|
|
37
37
|
// src/PromiseManager.ts
|
|
38
|
-
|
|
38
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
39
39
|
|
|
40
40
|
// src/utils/executeStrategies.ts
|
|
41
|
-
|
|
41
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
42
42
|
function hookSeq(promises) {
|
|
43
43
|
return promises.filter(Boolean).reduce(
|
|
44
44
|
(promise, func) => {
|
|
@@ -100,43 +100,12 @@ function isPromiseRejectedResult(result) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// src/errors.ts
|
|
103
|
-
|
|
103
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
104
104
|
var ValidationPluginError = class extends Error {
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
// src/plugin.ts
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// src/utils/cache.ts
|
|
111
|
-
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
112
|
-
function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
|
|
113
|
-
return {
|
|
114
|
-
set(id, value) {
|
|
115
|
-
Store[id] = [0, value];
|
|
116
|
-
},
|
|
117
|
-
get(id) {
|
|
118
|
-
const item = Store[id];
|
|
119
|
-
if (!item) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
item[0] = 0;
|
|
123
|
-
return item[1];
|
|
124
|
-
},
|
|
125
|
-
has(id) {
|
|
126
|
-
const item = Store[id];
|
|
127
|
-
if (!item) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
item[0] = 0;
|
|
131
|
-
return true;
|
|
132
|
-
},
|
|
133
|
-
delete(id) {
|
|
134
|
-
return delete Store[id];
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// src/plugin.ts
|
|
108
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
140
109
|
function createPlugin(factory) {
|
|
141
110
|
return (options = {}) => {
|
|
142
111
|
return factory(options);
|
|
@@ -170,8 +139,7 @@ var pluginCore = createPlugin((options) => {
|
|
|
170
139
|
return resolvedFiles;
|
|
171
140
|
},
|
|
172
141
|
resolvePath,
|
|
173
|
-
resolveName
|
|
174
|
-
cache: createPluginCache()
|
|
142
|
+
resolveName
|
|
175
143
|
};
|
|
176
144
|
},
|
|
177
145
|
resolvePath(baseName) {
|
|
@@ -186,9 +154,9 @@ var pluginCore = createPlugin((options) => {
|
|
|
186
154
|
|
|
187
155
|
// src/PluginManager.ts
|
|
188
156
|
var PluginManager = class {
|
|
189
|
-
plugins;
|
|
157
|
+
plugins = /* @__PURE__ */ new Set();
|
|
190
158
|
fileManager;
|
|
191
|
-
events = new
|
|
159
|
+
events = new chunkDU3QBH4U_cjs.EventEmitter();
|
|
192
160
|
config;
|
|
193
161
|
executed = [];
|
|
194
162
|
logger;
|
|
@@ -200,11 +168,10 @@ var PluginManager = class {
|
|
|
200
168
|
this.config = config;
|
|
201
169
|
this.options = options;
|
|
202
170
|
this.logger = options.logger;
|
|
203
|
-
this.fileManager = new
|
|
171
|
+
this.fileManager = new chunkQ2VSIEFB_cjs.FileManager();
|
|
204
172
|
this.#promiseManager = new PromiseManager({
|
|
205
173
|
nullCheck: (state) => !!state?.result
|
|
206
174
|
});
|
|
207
|
-
const plugins = config.plugins || [];
|
|
208
175
|
const core = pluginCore({
|
|
209
176
|
config,
|
|
210
177
|
logger: this.logger,
|
|
@@ -215,8 +182,9 @@ var PluginManager = class {
|
|
|
215
182
|
getPlugins: this.#getSortedPlugins.bind(this)
|
|
216
183
|
});
|
|
217
184
|
this.#core = this.#parse(core, this, core.context.call(null));
|
|
218
|
-
|
|
219
|
-
|
|
185
|
+
[this.#core, ...config.plugins || []].forEach((plugin) => {
|
|
186
|
+
const parsedPlugin = this.#parse(plugin, this, this.#core.context);
|
|
187
|
+
this.plugins.add(parsedPlugin);
|
|
220
188
|
});
|
|
221
189
|
return this;
|
|
222
190
|
}
|
|
@@ -286,14 +254,14 @@ Falling back on the first item.
|
|
|
286
254
|
]
|
|
287
255
|
});
|
|
288
256
|
}
|
|
289
|
-
return
|
|
257
|
+
return chunkNDHS47GW_cjs.transformReservedWord(names?.at(0) || params.name);
|
|
290
258
|
}
|
|
291
259
|
const name = this.hookFirstSync({
|
|
292
260
|
hookName: "resolveName",
|
|
293
261
|
parameters: [params.name, params.type],
|
|
294
262
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
295
263
|
}).result;
|
|
296
|
-
return
|
|
264
|
+
return chunkNDHS47GW_cjs.transformReservedWord(name);
|
|
297
265
|
};
|
|
298
266
|
/**
|
|
299
267
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -488,7 +456,7 @@ Falling back on the first item.
|
|
|
488
456
|
#getSortedPlugins(hookName) {
|
|
489
457
|
const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
|
|
490
458
|
if (hookName) {
|
|
491
|
-
return plugins.filter((
|
|
459
|
+
return plugins.filter((plugin) => hookName in plugin);
|
|
492
460
|
}
|
|
493
461
|
return plugins.map((plugin) => {
|
|
494
462
|
if (plugin.pre) {
|
|
@@ -511,7 +479,7 @@ Falling back on the first item.
|
|
|
511
479
|
getPluginsByKey(hookName, pluginKey) {
|
|
512
480
|
const plugins = [...this.plugins];
|
|
513
481
|
const [searchPluginName, searchIdentifier] = pluginKey;
|
|
514
|
-
const pluginByPluginName = plugins.filter((plugin) => plugin
|
|
482
|
+
const pluginByPluginName = plugins.filter((plugin) => hookName in plugin).filter((item) => {
|
|
515
483
|
const [name, identifier] = item.key;
|
|
516
484
|
const identifierCheck = identifier?.toString() === searchIdentifier?.toString();
|
|
517
485
|
const nameCheck = name === searchPluginName;
|
|
@@ -521,7 +489,7 @@ Falling back on the first item.
|
|
|
521
489
|
return nameCheck;
|
|
522
490
|
});
|
|
523
491
|
if (!pluginByPluginName?.length) {
|
|
524
|
-
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin
|
|
492
|
+
const corePlugin = plugins.find((plugin) => plugin.name === "core" && hookName in plugin);
|
|
525
493
|
if (corePlugin) {
|
|
526
494
|
this.logger.emit("debug", {
|
|
527
495
|
date: /* @__PURE__ */ new Date(),
|
|
@@ -649,7 +617,7 @@ Falling back on the first item.
|
|
|
649
617
|
}
|
|
650
618
|
#parse(plugin, pluginManager, context) {
|
|
651
619
|
const usedPluginNames = pluginManager.#usedPluginNames;
|
|
652
|
-
|
|
620
|
+
chunkQ2VSIEFB_cjs.setUniqueName(plugin.name, usedPluginNames);
|
|
653
621
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
654
622
|
if (plugin.context && typeof plugin.context === "function") {
|
|
655
623
|
return {
|
|
@@ -684,7 +652,7 @@ Falling back on the first item.
|
|
|
684
652
|
};
|
|
685
653
|
|
|
686
654
|
// src/config.ts
|
|
687
|
-
|
|
655
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
688
656
|
function defineConfig(options) {
|
|
689
657
|
return options;
|
|
690
658
|
}
|
|
@@ -692,9 +660,9 @@ function isInputPath(result) {
|
|
|
692
660
|
return !!result && "path" in result;
|
|
693
661
|
}
|
|
694
662
|
async function setup(options) {
|
|
695
|
-
const { config, logger =
|
|
663
|
+
const { config, logger = chunkDU3QBH4U_cjs.createLogger() } = options;
|
|
696
664
|
try {
|
|
697
|
-
if (isInputPath(config) && !new
|
|
665
|
+
if (isInputPath(config) && !new chunkQ2VSIEFB_cjs.URLPath(config.input.path).isURL) {
|
|
698
666
|
await fs.read(config.input.path);
|
|
699
667
|
}
|
|
700
668
|
} catch (e) {
|
|
@@ -750,14 +718,14 @@ async function safeBuild(options) {
|
|
|
750
718
|
if (!file.path || !source.isIndexable) {
|
|
751
719
|
return void 0;
|
|
752
720
|
}
|
|
753
|
-
const plugin = pluginManager.plugins.find((item) => {
|
|
721
|
+
const plugin = [...pluginManager.plugins].find((item) => {
|
|
754
722
|
const meta = file.meta;
|
|
755
723
|
return item.name === meta?.pluginKey?.[0];
|
|
756
724
|
});
|
|
757
725
|
if (plugin?.output?.exportType === false) {
|
|
758
726
|
return void 0;
|
|
759
727
|
}
|
|
760
|
-
if (
|
|
728
|
+
if (chunkQ2VSIEFB_cjs.FileManager.getMode(plugin?.output?.path) === "single") {
|
|
761
729
|
return void 0;
|
|
762
730
|
}
|
|
763
731
|
return {
|
|
@@ -773,7 +741,7 @@ async function safeBuild(options) {
|
|
|
773
741
|
if (options.config.output.exportType) {
|
|
774
742
|
await pluginManager.fileManager.add(rootFile);
|
|
775
743
|
}
|
|
776
|
-
files = await
|
|
744
|
+
files = await chunkQ2VSIEFB_cjs.processFiles({
|
|
777
745
|
config: options.config,
|
|
778
746
|
dryRun: !options.config.output.write,
|
|
779
747
|
files: pluginManager.fileManager.files,
|
|
@@ -795,7 +763,7 @@ async function safeBuild(options) {
|
|
|
795
763
|
}
|
|
796
764
|
|
|
797
765
|
// src/BaseGenerator.ts
|
|
798
|
-
|
|
766
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
799
767
|
var BaseGenerator = class {
|
|
800
768
|
#options = {};
|
|
801
769
|
#context = {};
|
|
@@ -820,22 +788,22 @@ var BaseGenerator = class {
|
|
|
820
788
|
};
|
|
821
789
|
|
|
822
790
|
// src/PackageManager.ts
|
|
823
|
-
|
|
791
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
824
792
|
|
|
825
793
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
826
|
-
|
|
794
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
827
795
|
|
|
828
796
|
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
829
|
-
|
|
797
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
830
798
|
|
|
831
799
|
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
832
|
-
|
|
800
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
833
801
|
|
|
834
802
|
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
835
|
-
|
|
803
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
836
804
|
|
|
837
805
|
// ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
|
838
|
-
|
|
806
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
839
807
|
var Node = class {
|
|
840
808
|
value;
|
|
841
809
|
next;
|
|
@@ -1027,13 +995,13 @@ function locatePathSync(paths, {
|
|
|
1027
995
|
}
|
|
1028
996
|
|
|
1029
997
|
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
1030
|
-
|
|
998
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
1031
999
|
function toPath2(urlOrPath) {
|
|
1032
1000
|
return urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
1033
1001
|
}
|
|
1034
1002
|
|
|
1035
1003
|
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
1036
|
-
|
|
1004
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
1037
1005
|
|
|
1038
1006
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
1039
1007
|
var findUpStop = Symbol("findUpStop");
|
|
@@ -1235,7 +1203,19 @@ var PackageManager = class _PackageManager {
|
|
|
1235
1203
|
|
|
1236
1204
|
Object.defineProperty(exports, "FileManager", {
|
|
1237
1205
|
enumerable: true,
|
|
1238
|
-
get: function () { return
|
|
1206
|
+
get: function () { return chunkQ2VSIEFB_cjs.FileManager; }
|
|
1207
|
+
});
|
|
1208
|
+
Object.defineProperty(exports, "combineExports", {
|
|
1209
|
+
enumerable: true,
|
|
1210
|
+
get: function () { return chunkQ2VSIEFB_cjs.combineExports; }
|
|
1211
|
+
});
|
|
1212
|
+
Object.defineProperty(exports, "combineImports", {
|
|
1213
|
+
enumerable: true,
|
|
1214
|
+
get: function () { return chunkQ2VSIEFB_cjs.combineImports; }
|
|
1215
|
+
});
|
|
1216
|
+
Object.defineProperty(exports, "combineSources", {
|
|
1217
|
+
enumerable: true,
|
|
1218
|
+
get: function () { return chunkQ2VSIEFB_cjs.combineSources; }
|
|
1239
1219
|
});
|
|
1240
1220
|
exports.BaseGenerator = BaseGenerator;
|
|
1241
1221
|
exports.PackageManager = PackageManager;
|