@kubb/core 5.0.0-beta.40 → 5.0.0-beta.41
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 -13
- package/dist/{diagnostics-DhfW8YpT.d.ts → diagnostics-Ba-FcsPo.d.ts} +35 -28
- package/dist/index.cjs +4 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -19
- package/dist/index.js.map +1 -1
- package/dist/{memoryStorage-DTv1Kub1.js → memoryStorage-DA1bnMte.js} +27 -19
- package/dist/{memoryStorage-DTv1Kub1.js.map → memoryStorage-DA1bnMte.js.map} +1 -1
- package/dist/{memoryStorage-Dkxnid2K.cjs → memoryStorage-DZqlEW7H.cjs} +27 -19
- package/dist/{memoryStorage-Dkxnid2K.cjs.map → memoryStorage-DZqlEW7H.cjs.map} +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +4 -4
- package/src/KubbDriver.ts +38 -29
- package/src/createKubb.ts +24 -0
- package/src/defineLogger.ts +10 -28
- package/src/types.ts +1 -0
|
@@ -635,7 +635,7 @@ var URLPath = class {
|
|
|
635
635
|
};
|
|
636
636
|
//#endregion
|
|
637
637
|
//#region package.json
|
|
638
|
-
var version = "5.0.0-beta.
|
|
638
|
+
var version = "5.0.0-beta.41";
|
|
639
639
|
//#endregion
|
|
640
640
|
//#region src/constants.ts
|
|
641
641
|
/**
|
|
@@ -2437,6 +2437,11 @@ var KubbDriver = class KubbDriver {
|
|
|
2437
2437
|
* A failing plugin contributes an error diagnostic so the rest of the build continues.
|
|
2438
2438
|
* Every plugin also contributes a `timing` diagnostic.
|
|
2439
2439
|
*
|
|
2440
|
+
* Plugins run sequentially so `kubb:plugin:end` fires as each plugin completes, instead
|
|
2441
|
+
* of all at once after every plugin has marched through the parallel batches together.
|
|
2442
|
+
* That ordering is what drives the CLI's `Plugins N/M` counter; without it the bar would
|
|
2443
|
+
* sit at the initial value until the very end of the run.
|
|
2444
|
+
*
|
|
2440
2445
|
* When `entries` is empty or `this.inputNode` is `null`, every entry still gets a
|
|
2441
2446
|
* `kubb:plugin:end` so middleware listeners (the barrel writer and friends) complete.
|
|
2442
2447
|
*/
|
|
@@ -2481,15 +2486,18 @@ var KubbDriver = class KubbDriver {
|
|
|
2481
2486
|
});
|
|
2482
2487
|
const emitsSchemaHook = this.hooks.listenerCount("kubb:generate:schema") > 0;
|
|
2483
2488
|
const emitsOperationHook = this.hooks.listenerCount("kubb:generate:operation") > 0;
|
|
2489
|
+
const emitsOperationsHook = this.hooks.listenerCount("kubb:generate:operations") > 0;
|
|
2490
|
+
const schemasBuffer = [];
|
|
2491
|
+
for await (const schema of schemas) schemasBuffer.push(schema);
|
|
2492
|
+
const operationsBuffer = [];
|
|
2493
|
+
for await (const operation of operations) operationsBuffer.push(operation);
|
|
2484
2494
|
const pruningStates = states.filter(({ plugin }) => {
|
|
2485
2495
|
const { include } = plugin.options;
|
|
2486
2496
|
return (include?.some(({ type }) => OPERATION_FILTER_TYPES.has(type)) ?? false) && !(include?.some(({ type }) => type === "schemaName") ?? false);
|
|
2487
2497
|
});
|
|
2488
2498
|
if (pruningStates.length > 0) {
|
|
2489
|
-
const allSchemas = [];
|
|
2490
|
-
for await (const schema of schemas) allSchemas.push(schema);
|
|
2491
2499
|
const includedOpsByState = new Map(pruningStates.map((state) => [state, []]));
|
|
2492
|
-
for
|
|
2500
|
+
for (const operation of operationsBuffer) for (const state of pruningStates) {
|
|
2493
2501
|
const { exclude, include, override } = state.plugin.options;
|
|
2494
2502
|
if (state.generatorContext.resolver.resolveOptions(operation, {
|
|
2495
2503
|
options: state.plugin.options,
|
|
@@ -2499,7 +2507,7 @@ var KubbDriver = class KubbDriver {
|
|
|
2499
2507
|
}) !== null) includedOpsByState.get(state)?.push(operation);
|
|
2500
2508
|
}
|
|
2501
2509
|
for (const state of pruningStates) {
|
|
2502
|
-
state.allowedSchemaNames = collectUsedSchemaNames(includedOpsByState.get(state) ?? [],
|
|
2510
|
+
state.allowedSchemaNames = collectUsedSchemaNames(includedOpsByState.get(state) ?? [], schemasBuffer);
|
|
2503
2511
|
includedOpsByState.delete(state);
|
|
2504
2512
|
}
|
|
2505
2513
|
}
|
|
@@ -2561,20 +2569,20 @@ var KubbDriver = class KubbDriver {
|
|
|
2561
2569
|
checkAllowedNames: false,
|
|
2562
2570
|
emit: emitsOperationHook ? (node, ctx) => this.hooks.emit("kubb:generate:operation", node, ctx) : null
|
|
2563
2571
|
};
|
|
2564
|
-
const needsCollectedOperations = this.hooks.listenerCount("kubb:generate:operations") > 0 || states.some((state) => state.generators.some((gen) => !!gen.operations));
|
|
2565
|
-
const collectedOperations = needsCollectedOperations ? [] : void 0;
|
|
2566
|
-
await forBatches(schemas, (nodes) => Promise.all(nodes.flatMap((node) => states.map((state) => dispatchNode(state, node, schemaDispatch)))), {
|
|
2567
|
-
concurrency: 8,
|
|
2568
|
-
flush: flushPending
|
|
2569
|
-
});
|
|
2570
|
-
await forBatches(operations, (nodes) => {
|
|
2571
|
-
if (needsCollectedOperations) collectedOperations?.push(...nodes);
|
|
2572
|
-
return Promise.all(nodes.flatMap((node) => states.map((state) => dispatchNode(state, node, operationDispatch))));
|
|
2573
|
-
}, {
|
|
2574
|
-
concurrency: 8,
|
|
2575
|
-
flush: flushPending
|
|
2576
|
-
});
|
|
2577
2572
|
for (const state of states) {
|
|
2573
|
+
const needsCollectedOperations = emitsOperationsHook || state.generators.some((gen) => !!gen.operations);
|
|
2574
|
+
const collectedOperations = needsCollectedOperations ? [] : void 0;
|
|
2575
|
+
await forBatches(schemasBuffer, (nodes) => Promise.all(nodes.map((node) => dispatchNode(state, node, schemaDispatch))), {
|
|
2576
|
+
concurrency: 8,
|
|
2577
|
+
flush: flushPending
|
|
2578
|
+
});
|
|
2579
|
+
await forBatches(operationsBuffer, (nodes) => {
|
|
2580
|
+
if (needsCollectedOperations) collectedOperations?.push(...nodes);
|
|
2581
|
+
return Promise.all(nodes.map((node) => dispatchNode(state, node, operationDispatch)));
|
|
2582
|
+
}, {
|
|
2583
|
+
concurrency: 8,
|
|
2584
|
+
flush: flushPending
|
|
2585
|
+
});
|
|
2578
2586
|
if (!state.failed && needsCollectedOperations) try {
|
|
2579
2587
|
const { plugin, generatorContext, generators } = state;
|
|
2580
2588
|
const ctx = {
|
|
@@ -2849,4 +2857,4 @@ const memoryStorage = createStorage(() => {
|
|
|
2849
2857
|
//#endregion
|
|
2850
2858
|
export { FileManager as a, createStorage as c, URLPath as d, formatMs as f, BuildError as g, AsyncEventEmitter as h, FileProcessor as i, Diagnostics as l, camelCase as m, KubbDriver as n, defineResolver as o, getElapsedMs as p, _usingCtx as r, definePlugin as s, memoryStorage as t, OTLP_ENDPOINT as u };
|
|
2851
2859
|
|
|
2852
|
-
//# sourceMappingURL=memoryStorage-
|
|
2860
|
+
//# sourceMappingURL=memoryStorage-DA1bnMte.js.map
|