@kubb/core 3.15.1 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{FileManager-HxsypMy8.d.cts → PluginManager-E3SghPP9.d.cts} +125 -161
- package/dist/{FileManager-Cm7Iylcx.d.ts → PluginManager-PDmRCu9k.d.ts} +125 -161
- package/dist/{chunk-7P6FFVGF.js → chunk-4V7HK7PT.js} +3 -3
- package/dist/{chunk-7P6FFVGF.js.map → chunk-4V7HK7PT.js.map} +1 -1
- package/dist/{chunk-TEEWO6UV.cjs → chunk-BHSTNFNQ.cjs} +2 -23
- package/dist/chunk-BHSTNFNQ.cjs.map +1 -0
- package/dist/{chunk-XTSQKCYI.js → chunk-CAZ37TGB.js} +93 -114
- package/dist/chunk-CAZ37TGB.js.map +1 -0
- package/dist/{chunk-MKN7YSK2.cjs → chunk-E4XLCCPK.cjs} +2 -20
- package/dist/chunk-E4XLCCPK.cjs.map +1 -0
- package/dist/{chunk-TJJOSCFA.cjs → chunk-MCNA6SYG.cjs} +5 -24
- package/dist/chunk-MCNA6SYG.cjs.map +1 -0
- package/dist/chunk-QR7CQIA3.cjs +943 -0
- package/dist/chunk-QR7CQIA3.cjs.map +1 -0
- package/dist/{chunk-CMKZBNCX.js → chunk-YRPOID7E.js} +2 -2
- package/dist/{chunk-CMKZBNCX.js.map → chunk-YRPOID7E.js.map} +1 -1
- package/dist/fs.cjs +9 -10
- package/dist/fs.d.cts +10 -2
- package/dist/fs.d.ts +10 -2
- package/dist/fs.js +1 -1
- package/dist/index.cjs +109 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +88 -83
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +6 -7
- package/dist/logger.js +2 -2
- package/dist/mocks.cjs +8 -11
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +2 -2
- package/dist/mocks.d.ts +2 -2
- package/dist/mocks.js +2 -2
- package/dist/{parser-CcELSk43.d.ts → parser-C1vOjVEd.d.ts} +2 -2
- package/dist/{parser-Dwb7eMU3.d.cts → parser-D6vU1kA9.d.cts} +2 -2
- package/dist/{prompt-55FJQYBV.cjs → prompt-U7M5G25C.cjs} +2 -4
- package/dist/prompt-U7M5G25C.cjs.map +1 -0
- package/dist/transformers.cjs +21 -22
- package/dist/{types-CX9JVw2n.d.cts → types-CA8nQKwM.d.cts} +1 -15
- package/dist/{types-CX9JVw2n.d.ts → types-CA8nQKwM.d.ts} +1 -15
- package/dist/utils.cjs +22 -19
- package/dist/utils.d.cts +15 -4
- package/dist/utils.d.ts +15 -4
- package/dist/utils.js +2 -2
- package/package.json +6 -6
- package/src/BarrelManager.ts +1 -20
- package/src/FileManager.ts +78 -121
- package/src/PluginManager.ts +40 -33
- package/src/PromiseManager.ts +2 -1
- package/src/__snapshots__/barrel.json +80 -6
- package/src/build.ts +57 -55
- package/src/fs/types.ts +0 -6
- package/src/index.ts +1 -1
- package/src/utils/Cache.ts +31 -0
- package/src/utils/executeStrategies.ts +9 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/parser.ts +6 -7
- package/dist/chunk-FAQ7SBKL.cjs +0 -1636
- package/dist/chunk-FAQ7SBKL.cjs.map +0 -1
- package/dist/chunk-KZOJCFA7.cjs +0 -42
- package/dist/chunk-KZOJCFA7.cjs.map +0 -1
- package/dist/chunk-MKN7YSK2.cjs.map +0 -1
- package/dist/chunk-TEEWO6UV.cjs.map +0 -1
- package/dist/chunk-TJJOSCFA.cjs.map +0 -1
- package/dist/chunk-XTSQKCYI.js.map +0 -1
- package/dist/prompt-55FJQYBV.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
5
|
+
var chunkMCNA6SYG_cjs = require('./chunk-MCNA6SYG.cjs');
|
|
6
|
+
var chunkQR7CQIA3_cjs = require('./chunk-QR7CQIA3.cjs');
|
|
7
|
+
var chunkBHSTNFNQ_cjs = require('./chunk-BHSTNFNQ.cjs');
|
|
8
|
+
var chunkE4XLCCPK_cjs = require('./chunk-E4XLCCPK.cjs');
|
|
9
|
+
var pLimit2 = require('p-limit');
|
|
10
10
|
var path3 = require('path');
|
|
11
|
+
var remeda = require('remeda');
|
|
11
12
|
var mod = require('module');
|
|
12
13
|
var os = require('os');
|
|
13
14
|
var url = require('url');
|
|
@@ -17,26 +18,13 @@ var semver = require('semver');
|
|
|
17
18
|
|
|
18
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
|
|
21
|
+
var pLimit2__default = /*#__PURE__*/_interopDefault(pLimit2);
|
|
20
22
|
var path3__default = /*#__PURE__*/_interopDefault(path3);
|
|
21
23
|
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
22
24
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
23
25
|
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
24
26
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
25
27
|
|
|
26
|
-
// src/index.ts
|
|
27
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
28
|
-
|
|
29
|
-
// src/build.ts
|
|
30
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
31
|
-
|
|
32
|
-
// src/PluginManager.ts
|
|
33
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
34
|
-
|
|
35
|
-
// src/PromiseManager.ts
|
|
36
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
37
|
-
|
|
38
|
-
// src/utils/executeStrategies.ts
|
|
39
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
40
28
|
function hookSeq(promises) {
|
|
41
29
|
return promises.filter(Boolean).reduce(
|
|
42
30
|
(promise, func) => {
|
|
@@ -65,8 +53,10 @@ function hookFirst(promises, nullCheck = (state) => state !== null) {
|
|
|
65
53
|
}
|
|
66
54
|
return promise;
|
|
67
55
|
}
|
|
68
|
-
function hookParallel(promises) {
|
|
69
|
-
|
|
56
|
+
function hookParallel(promises, concurrency = Number.POSITIVE_INFINITY) {
|
|
57
|
+
const limit = pLimit2__default.default(concurrency);
|
|
58
|
+
const tasks = promises.filter(Boolean).map((promise) => limit(() => promise()));
|
|
59
|
+
return Promise.allSettled(tasks);
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
// src/PromiseManager.ts
|
|
@@ -76,7 +66,7 @@ var PromiseManager = class {
|
|
|
76
66
|
this.#options = options;
|
|
77
67
|
return this;
|
|
78
68
|
}
|
|
79
|
-
run(strategy, promises) {
|
|
69
|
+
run(strategy, promises, { concurrency = Number.POSITIVE_INFINITY } = {}) {
|
|
80
70
|
if (strategy === "seq") {
|
|
81
71
|
return hookSeq(promises);
|
|
82
72
|
}
|
|
@@ -84,25 +74,18 @@ var PromiseManager = class {
|
|
|
84
74
|
return hookFirst(promises, this.#options.nullCheck);
|
|
85
75
|
}
|
|
86
76
|
if (strategy === "parallel") {
|
|
87
|
-
return hookParallel(promises);
|
|
77
|
+
return hookParallel(promises, concurrency);
|
|
88
78
|
}
|
|
89
79
|
throw new Error(`${strategy} not implemented`);
|
|
90
80
|
}
|
|
91
81
|
};
|
|
92
|
-
function isPromise(result) {
|
|
93
|
-
return !!result && typeof result?.then === "function";
|
|
94
|
-
}
|
|
95
82
|
function isPromiseRejectedResult(result) {
|
|
96
83
|
return result.status === "rejected";
|
|
97
84
|
}
|
|
98
85
|
|
|
99
86
|
// src/errors.ts
|
|
100
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
101
87
|
var ValidationPluginError = class extends Error {
|
|
102
88
|
};
|
|
103
|
-
|
|
104
|
-
// src/plugin.ts
|
|
105
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
106
89
|
function createPlugin(factory) {
|
|
107
90
|
return (options = {}) => {
|
|
108
91
|
return factory(options);
|
|
@@ -153,7 +136,7 @@ var pluginCore = createPlugin((options) => {
|
|
|
153
136
|
var PluginManager = class {
|
|
154
137
|
plugins = /* @__PURE__ */ new Set();
|
|
155
138
|
fileManager;
|
|
156
|
-
events = new
|
|
139
|
+
events = new chunkMCNA6SYG_cjs.EventEmitter();
|
|
157
140
|
config;
|
|
158
141
|
executed = [];
|
|
159
142
|
logger;
|
|
@@ -165,7 +148,7 @@ var PluginManager = class {
|
|
|
165
148
|
this.config = config;
|
|
166
149
|
this.options = options;
|
|
167
150
|
this.logger = options.logger;
|
|
168
|
-
this.fileManager = new
|
|
151
|
+
this.fileManager = new chunkQR7CQIA3_cjs.FileManager();
|
|
169
152
|
this.#promiseManager = new PromiseManager({
|
|
170
153
|
nullCheck: (state) => !!state?.result
|
|
171
154
|
});
|
|
@@ -235,7 +218,7 @@ Falling back on the first item.
|
|
|
235
218
|
const names = this.hookForPluginSync({
|
|
236
219
|
pluginKey: params.pluginKey,
|
|
237
220
|
hookName: "resolveName",
|
|
238
|
-
parameters: [
|
|
221
|
+
parameters: [chunkBHSTNFNQ_cjs.trim(params.name), params.type],
|
|
239
222
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
240
223
|
});
|
|
241
224
|
if (names && names?.length > 1) {
|
|
@@ -251,14 +234,14 @@ Falling back on the first item.
|
|
|
251
234
|
]
|
|
252
235
|
});
|
|
253
236
|
}
|
|
254
|
-
return
|
|
237
|
+
return chunkBHSTNFNQ_cjs.transformReservedWord(names?.at(0) || params.name);
|
|
255
238
|
}
|
|
256
239
|
const name = this.hookFirstSync({
|
|
257
240
|
hookName: "resolveName",
|
|
258
|
-
parameters: [
|
|
241
|
+
parameters: [chunkBHSTNFNQ_cjs.trim(params.name), params.type],
|
|
259
242
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
260
243
|
}).result;
|
|
261
|
-
return
|
|
244
|
+
return chunkBHSTNFNQ_cjs.transformReservedWord(name);
|
|
262
245
|
};
|
|
263
246
|
/**
|
|
264
247
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -277,16 +260,19 @@ Falling back on the first item.
|
|
|
277
260
|
}) {
|
|
278
261
|
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
279
262
|
this.logger.emit("progress_start", { id: hookName, size: plugins.length, message: "Running plugins..." });
|
|
280
|
-
const
|
|
281
|
-
|
|
263
|
+
const items = [];
|
|
264
|
+
for (const plugin of plugins) {
|
|
265
|
+
const result = await this.#execute({
|
|
282
266
|
strategy: "hookFirst",
|
|
283
267
|
hookName,
|
|
284
268
|
parameters,
|
|
285
269
|
plugin,
|
|
286
270
|
message
|
|
287
271
|
});
|
|
288
|
-
|
|
289
|
-
|
|
272
|
+
if (result !== void 0 && result !== null) {
|
|
273
|
+
items.push(result);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
290
276
|
this.logger.emit("progress_stop", { id: hookName });
|
|
291
277
|
return items;
|
|
292
278
|
}
|
|
@@ -392,7 +378,7 @@ Falling back on the first item.
|
|
|
392
378
|
message
|
|
393
379
|
});
|
|
394
380
|
});
|
|
395
|
-
const results = await this.#promiseManager.run("parallel", promises);
|
|
381
|
+
const results = await this.#promiseManager.run("parallel", promises, { concurrency: this.options.concurrency });
|
|
396
382
|
results.forEach((result, index) => {
|
|
397
383
|
if (isPromiseRejectedResult(result)) {
|
|
398
384
|
const plugin = this.#getSortedPlugins(hookName)[index];
|
|
@@ -511,33 +497,36 @@ Falling back on the first item.
|
|
|
511
497
|
return null;
|
|
512
498
|
}
|
|
513
499
|
this.events.emit("executing", { strategy, hookName, parameters, plugin, message });
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
500
|
+
const task = (async () => {
|
|
501
|
+
try {
|
|
502
|
+
if (typeof hook === "function") {
|
|
503
|
+
const result = await Promise.resolve(hook.apply({ ...this.#core.context, plugin }, parameters));
|
|
504
|
+
output = result;
|
|
505
|
+
this.#addExecutedToCallStack({
|
|
506
|
+
parameters,
|
|
507
|
+
output,
|
|
508
|
+
strategy,
|
|
509
|
+
hookName,
|
|
510
|
+
plugin,
|
|
511
|
+
message
|
|
512
|
+
});
|
|
513
|
+
return result;
|
|
522
514
|
}
|
|
523
|
-
|
|
515
|
+
output = hook;
|
|
516
|
+
this.#addExecutedToCallStack({
|
|
517
|
+
parameters,
|
|
518
|
+
output,
|
|
519
|
+
strategy,
|
|
520
|
+
hookName,
|
|
521
|
+
plugin,
|
|
522
|
+
message
|
|
523
|
+
});
|
|
524
|
+
return hook;
|
|
525
|
+
} catch (e) {
|
|
526
|
+
this.#catcher(e, plugin, hookName);
|
|
527
|
+
return null;
|
|
524
528
|
}
|
|
525
|
-
|
|
526
|
-
}).then((result) => {
|
|
527
|
-
output = result;
|
|
528
|
-
this.#addExecutedToCallStack({
|
|
529
|
-
parameters,
|
|
530
|
-
output,
|
|
531
|
-
strategy,
|
|
532
|
-
hookName,
|
|
533
|
-
plugin,
|
|
534
|
-
message
|
|
535
|
-
});
|
|
536
|
-
return result;
|
|
537
|
-
}).catch((e) => {
|
|
538
|
-
this.#catcher(e, plugin, hookName);
|
|
539
|
-
return null;
|
|
540
|
-
});
|
|
529
|
+
})();
|
|
541
530
|
return task;
|
|
542
531
|
}
|
|
543
532
|
/**
|
|
@@ -596,7 +585,7 @@ Falling back on the first item.
|
|
|
596
585
|
}
|
|
597
586
|
#parse(plugin, pluginManager, context) {
|
|
598
587
|
const usedPluginNames = pluginManager.#usedPluginNames;
|
|
599
|
-
|
|
588
|
+
chunkQR7CQIA3_cjs.setUniqueName(plugin.name, usedPluginNames);
|
|
600
589
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
601
590
|
if (plugin.context && typeof plugin.context === "function") {
|
|
602
591
|
return {
|
|
@@ -631,7 +620,6 @@ Falling back on the first item.
|
|
|
631
620
|
};
|
|
632
621
|
|
|
633
622
|
// src/config.ts
|
|
634
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
635
623
|
function defineConfig(options) {
|
|
636
624
|
return options;
|
|
637
625
|
}
|
|
@@ -642,13 +630,13 @@ async function setup(options) {
|
|
|
642
630
|
if (options.pluginManager) {
|
|
643
631
|
return options.pluginManager;
|
|
644
632
|
}
|
|
645
|
-
const { config: userConfig, logger =
|
|
633
|
+
const { config: userConfig, logger = chunkMCNA6SYG_cjs.createLogger() } = options;
|
|
646
634
|
if (Array.isArray(userConfig.input)) {
|
|
647
|
-
|
|
635
|
+
chunkMCNA6SYG_cjs.consola.warn(chunkMCNA6SYG_cjs.colors.yellow("This feature is still under development \u2014 use with caution"));
|
|
648
636
|
}
|
|
649
637
|
try {
|
|
650
|
-
if (isInputPath(userConfig) && !new
|
|
651
|
-
await
|
|
638
|
+
if (isInputPath(userConfig) && !new chunkQR7CQIA3_cjs.URLPath(userConfig.input.path).isURL) {
|
|
639
|
+
await chunkE4XLCCPK_cjs.exists(userConfig.input.path);
|
|
652
640
|
}
|
|
653
641
|
} catch (e) {
|
|
654
642
|
if (isInputPath(userConfig)) {
|
|
@@ -675,10 +663,10 @@ async function setup(options) {
|
|
|
675
663
|
plugins: userConfig.plugins
|
|
676
664
|
};
|
|
677
665
|
if (definedConfig.output.clean) {
|
|
678
|
-
await
|
|
679
|
-
await
|
|
666
|
+
await chunkE4XLCCPK_cjs.clean(definedConfig.output.path);
|
|
667
|
+
await chunkE4XLCCPK_cjs.clean(path3.join(definedConfig.root, ".kubb"));
|
|
680
668
|
}
|
|
681
|
-
return new PluginManager(definedConfig, { logger });
|
|
669
|
+
return new PluginManager(definedConfig, { logger, concurrency: 5 });
|
|
682
670
|
}
|
|
683
671
|
async function build(options) {
|
|
684
672
|
const { files, pluginManager, error } = await safeBuild(options);
|
|
@@ -690,7 +678,6 @@ async function build(options) {
|
|
|
690
678
|
};
|
|
691
679
|
}
|
|
692
680
|
async function safeBuild(options) {
|
|
693
|
-
let files = [];
|
|
694
681
|
const pluginManager = await setup(options);
|
|
695
682
|
const config = pluginManager.config;
|
|
696
683
|
try {
|
|
@@ -708,50 +695,54 @@ async function safeBuild(options) {
|
|
|
708
695
|
parameters: [config],
|
|
709
696
|
message: "buildStart"
|
|
710
697
|
});
|
|
711
|
-
const root = path3.resolve(config.root);
|
|
712
|
-
const rootPath = path3.resolve(root, config.output.path, "index.ts");
|
|
713
|
-
const barrelFiles = pluginManager.fileManager.files.filter((file) => {
|
|
714
|
-
return file.sources.some((source) => source.isIndexable);
|
|
715
|
-
});
|
|
716
|
-
const rootFile = {
|
|
717
|
-
path: rootPath,
|
|
718
|
-
baseName: "index.ts",
|
|
719
|
-
exports: barrelFiles.flatMap((file) => {
|
|
720
|
-
const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly);
|
|
721
|
-
return file.sources?.map((source) => {
|
|
722
|
-
if (!file.path || !source.isIndexable) {
|
|
723
|
-
return void 0;
|
|
724
|
-
}
|
|
725
|
-
const plugin = [...pluginManager.plugins].find((item) => {
|
|
726
|
-
const meta = file.meta;
|
|
727
|
-
return item.key === meta?.pluginKey;
|
|
728
|
-
});
|
|
729
|
-
const pluginOptions = plugin?.options;
|
|
730
|
-
if (!pluginOptions || pluginOptions?.output?.barrelType === false) {
|
|
731
|
-
return void 0;
|
|
732
|
-
}
|
|
733
|
-
return {
|
|
734
|
-
name: config.output.barrelType === "all" ? void 0 : [source.name],
|
|
735
|
-
path: chunkMKN7YSK2_cjs.getRelativePath(rootPath, file.path),
|
|
736
|
-
isTypeOnly: config.output.barrelType === "all" ? containsOnlyTypes : source.isTypeOnly
|
|
737
|
-
};
|
|
738
|
-
}).filter(Boolean);
|
|
739
|
-
}).filter(Boolean),
|
|
740
|
-
sources: [],
|
|
741
|
-
meta: {}
|
|
742
|
-
};
|
|
743
698
|
if (config.output.barrelType) {
|
|
699
|
+
const root = path3.resolve(config.root);
|
|
700
|
+
const rootPath = path3.resolve(root, config.output.path, "index.ts");
|
|
701
|
+
const files2 = await pluginManager.fileManager.getFiles();
|
|
702
|
+
const barrelFiles = files2.filter((file) => {
|
|
703
|
+
return file.sources.some((source) => source.isIndexable);
|
|
704
|
+
});
|
|
705
|
+
const rootFile = {
|
|
706
|
+
path: rootPath,
|
|
707
|
+
baseName: "index.ts",
|
|
708
|
+
exports: barrelFiles.flatMap((file) => {
|
|
709
|
+
const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly);
|
|
710
|
+
return file.sources?.map((source) => {
|
|
711
|
+
if (!file.path || !source.isIndexable) {
|
|
712
|
+
return void 0;
|
|
713
|
+
}
|
|
714
|
+
const plugin = [...pluginManager.plugins].find((item) => {
|
|
715
|
+
const meta = file.meta;
|
|
716
|
+
return remeda.isDeepEqual(item.key, meta?.pluginKey);
|
|
717
|
+
});
|
|
718
|
+
const pluginOptions = plugin?.options;
|
|
719
|
+
if (!pluginOptions || pluginOptions?.output?.barrelType === false) {
|
|
720
|
+
return void 0;
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
name: config.output.barrelType === "all" ? void 0 : [source.name],
|
|
724
|
+
path: chunkE4XLCCPK_cjs.getRelativePath(rootPath, file.path),
|
|
725
|
+
isTypeOnly: config.output.barrelType === "all" ? containsOnlyTypes : source.isTypeOnly
|
|
726
|
+
};
|
|
727
|
+
}).filter(Boolean);
|
|
728
|
+
}).filter(Boolean),
|
|
729
|
+
sources: [],
|
|
730
|
+
meta: {}
|
|
731
|
+
};
|
|
744
732
|
await pluginManager.fileManager.add(rootFile);
|
|
745
733
|
}
|
|
746
|
-
files = await
|
|
734
|
+
const files = await pluginManager.fileManager.processFiles({
|
|
747
735
|
root: config.root,
|
|
748
736
|
extension: config.output.extension,
|
|
749
737
|
dryRun: !config.output.write,
|
|
750
|
-
files: pluginManager.fileManager.files,
|
|
751
738
|
logger: pluginManager.logger
|
|
752
739
|
});
|
|
753
740
|
await pluginManager.hookParallel({ hookName: "buildEnd", message: `Build stopped for ${config.name}` });
|
|
754
|
-
pluginManager.fileManager.clear();
|
|
741
|
+
await pluginManager.fileManager.clear();
|
|
742
|
+
return {
|
|
743
|
+
files,
|
|
744
|
+
pluginManager
|
|
745
|
+
};
|
|
755
746
|
} catch (e) {
|
|
756
747
|
return {
|
|
757
748
|
files: [],
|
|
@@ -759,14 +750,9 @@ async function safeBuild(options) {
|
|
|
759
750
|
error: e
|
|
760
751
|
};
|
|
761
752
|
}
|
|
762
|
-
return {
|
|
763
|
-
files,
|
|
764
|
-
pluginManager
|
|
765
|
-
};
|
|
766
753
|
}
|
|
767
754
|
|
|
768
755
|
// src/BaseGenerator.ts
|
|
769
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
770
756
|
var BaseGenerator = class {
|
|
771
757
|
#options = {};
|
|
772
758
|
#context = {};
|
|
@@ -789,133 +775,6 @@ var BaseGenerator = class {
|
|
|
789
775
|
this.#options = { ...this.#options, ...options };
|
|
790
776
|
}
|
|
791
777
|
};
|
|
792
|
-
|
|
793
|
-
// src/PackageManager.ts
|
|
794
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
795
|
-
|
|
796
|
-
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
797
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
798
|
-
|
|
799
|
-
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
800
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
801
|
-
|
|
802
|
-
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
803
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
804
|
-
|
|
805
|
-
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
806
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
807
|
-
|
|
808
|
-
// ../../node_modules/.pnpm/yocto-queue@1.1.1/node_modules/yocto-queue/index.js
|
|
809
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
810
|
-
var Node = class {
|
|
811
|
-
value;
|
|
812
|
-
next;
|
|
813
|
-
constructor(value) {
|
|
814
|
-
this.value = value;
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
var Queue = class {
|
|
818
|
-
#head;
|
|
819
|
-
#tail;
|
|
820
|
-
#size;
|
|
821
|
-
constructor() {
|
|
822
|
-
this.clear();
|
|
823
|
-
}
|
|
824
|
-
enqueue(value) {
|
|
825
|
-
const node = new Node(value);
|
|
826
|
-
if (this.#head) {
|
|
827
|
-
this.#tail.next = node;
|
|
828
|
-
this.#tail = node;
|
|
829
|
-
} else {
|
|
830
|
-
this.#head = node;
|
|
831
|
-
this.#tail = node;
|
|
832
|
-
}
|
|
833
|
-
this.#size++;
|
|
834
|
-
}
|
|
835
|
-
dequeue() {
|
|
836
|
-
const current = this.#head;
|
|
837
|
-
if (!current) {
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
this.#head = this.#head.next;
|
|
841
|
-
this.#size--;
|
|
842
|
-
return current.value;
|
|
843
|
-
}
|
|
844
|
-
peek() {
|
|
845
|
-
if (!this.#head) {
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
return this.#head.value;
|
|
849
|
-
}
|
|
850
|
-
clear() {
|
|
851
|
-
this.#head = void 0;
|
|
852
|
-
this.#tail = void 0;
|
|
853
|
-
this.#size = 0;
|
|
854
|
-
}
|
|
855
|
-
get size() {
|
|
856
|
-
return this.#size;
|
|
857
|
-
}
|
|
858
|
-
*[Symbol.iterator]() {
|
|
859
|
-
let current = this.#head;
|
|
860
|
-
while (current) {
|
|
861
|
-
yield current.value;
|
|
862
|
-
current = current.next;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
868
|
-
function pLimit(concurrency) {
|
|
869
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
870
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
871
|
-
}
|
|
872
|
-
const queue = new Queue();
|
|
873
|
-
let activeCount = 0;
|
|
874
|
-
const next = () => {
|
|
875
|
-
activeCount--;
|
|
876
|
-
if (queue.size > 0) {
|
|
877
|
-
queue.dequeue()();
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
const run = async (fn, resolve2, args) => {
|
|
881
|
-
activeCount++;
|
|
882
|
-
const result = (async () => fn(...args))();
|
|
883
|
-
resolve2(result);
|
|
884
|
-
try {
|
|
885
|
-
await result;
|
|
886
|
-
} catch {
|
|
887
|
-
}
|
|
888
|
-
next();
|
|
889
|
-
};
|
|
890
|
-
const enqueue = (fn, resolve2, args) => {
|
|
891
|
-
queue.enqueue(run.bind(void 0, fn, resolve2, args));
|
|
892
|
-
(async () => {
|
|
893
|
-
await Promise.resolve();
|
|
894
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
895
|
-
queue.dequeue()();
|
|
896
|
-
}
|
|
897
|
-
})();
|
|
898
|
-
};
|
|
899
|
-
const generator = (fn, ...args) => new Promise((resolve2) => {
|
|
900
|
-
enqueue(fn, resolve2, args);
|
|
901
|
-
});
|
|
902
|
-
Object.defineProperties(generator, {
|
|
903
|
-
activeCount: {
|
|
904
|
-
get: () => activeCount
|
|
905
|
-
},
|
|
906
|
-
pendingCount: {
|
|
907
|
-
get: () => queue.size
|
|
908
|
-
},
|
|
909
|
-
clearQueue: {
|
|
910
|
-
value: () => {
|
|
911
|
-
queue.clear();
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
|
-
return generator;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
919
778
|
var EndError = class extends Error {
|
|
920
779
|
constructor(value) {
|
|
921
780
|
super();
|
|
@@ -934,9 +793,9 @@ async function pLocate(iterable, tester, {
|
|
|
934
793
|
concurrency = Number.POSITIVE_INFINITY,
|
|
935
794
|
preserveOrder = true
|
|
936
795
|
} = {}) {
|
|
937
|
-
const limit =
|
|
796
|
+
const limit = pLimit2__default.default(concurrency);
|
|
938
797
|
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
939
|
-
const checkLimit =
|
|
798
|
+
const checkLimit = pLimit2__default.default(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
940
799
|
try {
|
|
941
800
|
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
942
801
|
} catch (error) {
|
|
@@ -1002,16 +861,10 @@ function locatePathSync(paths, {
|
|
|
1002
861
|
}
|
|
1003
862
|
}
|
|
1004
863
|
}
|
|
1005
|
-
|
|
1006
|
-
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
1007
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
1008
864
|
function toPath2(urlOrPath) {
|
|
1009
865
|
return urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
1010
866
|
}
|
|
1011
867
|
|
|
1012
|
-
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
1013
|
-
chunkKZOJCFA7_cjs.init_cjs_shims();
|
|
1014
|
-
|
|
1015
868
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
1016
869
|
var findUpStop = Symbol("findUpStop");
|
|
1017
870
|
async function findUpMultiple(name, options = {}) {
|
|
@@ -1136,7 +989,7 @@ var PackageManager = class _PackageManager {
|
|
|
1136
989
|
if (!pkgPath) {
|
|
1137
990
|
return void 0;
|
|
1138
991
|
}
|
|
1139
|
-
const json = await
|
|
992
|
+
const json = await chunkE4XLCCPK_cjs.read(pkgPath);
|
|
1140
993
|
return JSON.parse(json);
|
|
1141
994
|
}
|
|
1142
995
|
getPackageJSONSync() {
|
|
@@ -1146,7 +999,7 @@ var PackageManager = class _PackageManager {
|
|
|
1146
999
|
if (!pkgPath) {
|
|
1147
1000
|
return void 0;
|
|
1148
1001
|
}
|
|
1149
|
-
const json =
|
|
1002
|
+
const json = chunkE4XLCCPK_cjs.readSync(pkgPath);
|
|
1150
1003
|
return JSON.parse(json);
|
|
1151
1004
|
}
|
|
1152
1005
|
static setVersion(dependency, version) {
|
|
@@ -1215,19 +1068,15 @@ var PackageManager = class _PackageManager {
|
|
|
1215
1068
|
|
|
1216
1069
|
Object.defineProperty(exports, "FileManager", {
|
|
1217
1070
|
enumerable: true,
|
|
1218
|
-
get: function () { return
|
|
1071
|
+
get: function () { return chunkQR7CQIA3_cjs.FileManager; }
|
|
1219
1072
|
});
|
|
1220
1073
|
Object.defineProperty(exports, "getDefaultBanner", {
|
|
1221
1074
|
enumerable: true,
|
|
1222
|
-
get: function () { return
|
|
1075
|
+
get: function () { return chunkQR7CQIA3_cjs.getDefaultBanner; }
|
|
1223
1076
|
});
|
|
1224
1077
|
Object.defineProperty(exports, "getSource", {
|
|
1225
1078
|
enumerable: true,
|
|
1226
|
-
get: function () { return
|
|
1227
|
-
});
|
|
1228
|
-
Object.defineProperty(exports, "processFiles", {
|
|
1229
|
-
enumerable: true,
|
|
1230
|
-
get: function () { return chunkFAQ7SBKL_cjs.processFiles; }
|
|
1079
|
+
get: function () { return chunkQR7CQIA3_cjs.getSource; }
|
|
1231
1080
|
});
|
|
1232
1081
|
exports.BaseGenerator = BaseGenerator;
|
|
1233
1082
|
exports.PackageManager = PackageManager;
|