@kubb/core 5.0.0-alpha.24 → 5.0.0-alpha.26
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/{PluginDriver-P920mak9.d.ts → PluginDriver-BGRDpPpK.d.ts} +2 -2
- package/dist/hooks.d.ts +1 -1
- package/dist/index.cjs +121 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -2
- package/dist/index.js +119 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/renderNode.tsx +90 -1
|
@@ -28,7 +28,7 @@ declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[
|
|
|
28
28
|
*/
|
|
29
29
|
constructor(maxListener?: number);
|
|
30
30
|
/**
|
|
31
|
-
* Emits `eventName` and awaits all registered listeners
|
|
31
|
+
* Emits `eventName` and awaits all registered listeners sequentially.
|
|
32
32
|
* Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
@@ -1448,4 +1448,4 @@ declare class PluginDriver {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
//#endregion
|
|
1450
1450
|
export { formatters as $, PrinterFactoryOptions as A, UserConfig as B, PluginLifecycle as C, Preset as D, PluginWithLifeCycle as E, ResolvePathParams as F, UserResolver as G, UserLogger as H, Resolver as I, Generator as J, KubbEvents as K, ResolverContext as L, ResolveNameParams as M, ResolveOptionsContext as N, Presets as O, ResolvePathOptions as P, createStorage as Q, ResolverFileParams as R, PluginFactoryOptions as S, PluginParameter as T, UserPlugin as U, UserGroup as V, UserPluginWithLifeCycle as W, defineGenerator as X, ReactGeneratorV2 as Y, Storage as Z, LoggerOptions as _, AdapterSource as a, Plugin as b, Config as c, Group as d, linters as et, Include as f, LoggerContext as g, Logger as h, AdapterFactoryOptions as i, ResolveBannerContext as j, Printer as k, DevtoolsOptions as l, InputPath as m, getMode as n, PossiblePromise as nt, BarrelType as o, InputData as p, CoreGeneratorV2 as q, Adapter as r, AsyncEventEmitter as rt, CompatibilityPreset as s, PluginDriver as t, logLevel as tt, Exclude as u, Output as v, PluginLifecycleHooks as w, PluginContext as x, Override as y, ResolverPathParams as z };
|
|
1451
|
-
//# sourceMappingURL=PluginDriver-
|
|
1451
|
+
//# sourceMappingURL=PluginDriver-BGRDpPpK.d.ts.map
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { S as PluginFactoryOptions, b as Plugin, t as PluginDriver } from "./PluginDriver-
|
|
2
|
+
import { S as PluginFactoryOptions, b as Plugin, t as PluginDriver } from "./PluginDriver-BGRDpPpK.js";
|
|
3
3
|
import { FabricFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useDriver.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ var AsyncEventEmitter = class {
|
|
|
76
76
|
}
|
|
77
77
|
#emitter = new node_events.EventEmitter();
|
|
78
78
|
/**
|
|
79
|
-
* Emits `eventName` and awaits all registered listeners
|
|
79
|
+
* Emits `eventName` and awaits all registered listeners sequentially.
|
|
80
80
|
* Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
|
|
81
81
|
*
|
|
82
82
|
* @example
|
|
@@ -87,19 +87,17 @@ var AsyncEventEmitter = class {
|
|
|
87
87
|
async emit(eventName, ...eventArgs) {
|
|
88
88
|
const listeners = this.#emitter.listeners(eventName);
|
|
89
89
|
if (listeners.length === 0) return;
|
|
90
|
-
|
|
90
|
+
for (const listener of listeners) try {
|
|
91
|
+
await listener(...eventArgs);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
let serializedArgs;
|
|
91
94
|
try {
|
|
92
|
-
|
|
93
|
-
} catch
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
serializedArgs = JSON.stringify(eventArgs);
|
|
97
|
-
} catch {
|
|
98
|
-
serializedArgs = String(eventArgs);
|
|
99
|
-
}
|
|
100
|
-
throw new Error(`Error in async listener for "${eventName}" with eventArgs ${serializedArgs}`, { cause: toError(err) });
|
|
95
|
+
serializedArgs = JSON.stringify(eventArgs);
|
|
96
|
+
} catch {
|
|
97
|
+
serializedArgs = String(eventArgs);
|
|
101
98
|
}
|
|
102
|
-
|
|
99
|
+
throw new Error(`Error in async listener for "${eventName}" with eventArgs ${serializedArgs}`, { cause: toError(err) });
|
|
100
|
+
}
|
|
103
101
|
}
|
|
104
102
|
/**
|
|
105
103
|
* Registers a persistent listener for `eventName`.
|
|
@@ -1418,7 +1416,7 @@ const fsStorage = createStorage(() => ({
|
|
|
1418
1416
|
}));
|
|
1419
1417
|
//#endregion
|
|
1420
1418
|
//#region package.json
|
|
1421
|
-
var version = "5.0.0-alpha.
|
|
1419
|
+
var version = "5.0.0-alpha.26";
|
|
1422
1420
|
//#endregion
|
|
1423
1421
|
//#region src/utils/diagnostics.ts
|
|
1424
1422
|
/**
|
|
@@ -2249,6 +2247,113 @@ async function renderSchema(node, options) {
|
|
|
2249
2247
|
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
2250
2248
|
fabricChild.unmount();
|
|
2251
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Dispatches a single schema node to all generators (react + core).
|
|
2252
|
+
* Resolves options per generator and skips excluded nodes.
|
|
2253
|
+
*/
|
|
2254
|
+
async function runGeneratorSchema(node, ctx) {
|
|
2255
|
+
const { generators, plugin, resolver, exclude, include, override, fabric, adapter, config, driver } = ctx;
|
|
2256
|
+
for (const generator of generators) {
|
|
2257
|
+
const options = resolver.resolveOptions(node, {
|
|
2258
|
+
options: plugin.options,
|
|
2259
|
+
exclude,
|
|
2260
|
+
include,
|
|
2261
|
+
override
|
|
2262
|
+
});
|
|
2263
|
+
if (options === null) continue;
|
|
2264
|
+
if (generator.type === "react" && generator.version === "2") await renderSchema(node, {
|
|
2265
|
+
options,
|
|
2266
|
+
resolver,
|
|
2267
|
+
adapter,
|
|
2268
|
+
config,
|
|
2269
|
+
fabric,
|
|
2270
|
+
Component: generator.Schema,
|
|
2271
|
+
plugin,
|
|
2272
|
+
driver
|
|
2273
|
+
});
|
|
2274
|
+
if (generator.type === "core" && generator.version === "2") {
|
|
2275
|
+
const files = await generator.schema?.({
|
|
2276
|
+
node,
|
|
2277
|
+
options,
|
|
2278
|
+
resolver,
|
|
2279
|
+
adapter,
|
|
2280
|
+
config,
|
|
2281
|
+
plugin,
|
|
2282
|
+
driver
|
|
2283
|
+
}) ?? [];
|
|
2284
|
+
await fabric.upsertFile(...files);
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Dispatches a single operation node to all generators (react + core).
|
|
2290
|
+
* Resolves options per generator and skips excluded nodes.
|
|
2291
|
+
*/
|
|
2292
|
+
async function runGeneratorOperation(node, ctx) {
|
|
2293
|
+
const { generators, plugin, resolver, exclude, include, override, fabric, adapter, config, driver } = ctx;
|
|
2294
|
+
for (const generator of generators) {
|
|
2295
|
+
const options = resolver.resolveOptions(node, {
|
|
2296
|
+
options: plugin.options,
|
|
2297
|
+
exclude,
|
|
2298
|
+
include,
|
|
2299
|
+
override
|
|
2300
|
+
});
|
|
2301
|
+
if (options === null) continue;
|
|
2302
|
+
if (generator.type === "react" && generator.version === "2") await renderOperation(node, {
|
|
2303
|
+
options,
|
|
2304
|
+
resolver,
|
|
2305
|
+
adapter,
|
|
2306
|
+
config,
|
|
2307
|
+
fabric,
|
|
2308
|
+
Component: generator.Operation,
|
|
2309
|
+
plugin,
|
|
2310
|
+
driver
|
|
2311
|
+
});
|
|
2312
|
+
if (generator.type === "core" && generator.version === "2") {
|
|
2313
|
+
const files = await generator.operation?.({
|
|
2314
|
+
node,
|
|
2315
|
+
options,
|
|
2316
|
+
resolver,
|
|
2317
|
+
adapter,
|
|
2318
|
+
config,
|
|
2319
|
+
plugin,
|
|
2320
|
+
driver
|
|
2321
|
+
}) ?? [];
|
|
2322
|
+
await fabric.upsertFile(...files);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Batch-dispatches all collected operation nodes to every generator (react + core).
|
|
2328
|
+
* Uses `plugin.options` directly — no per-node option resolution.
|
|
2329
|
+
*/
|
|
2330
|
+
async function runGeneratorOperations(nodes, ctx) {
|
|
2331
|
+
const { generators, plugin, resolver, fabric, adapter, config, driver } = ctx;
|
|
2332
|
+
for (const generator of generators) {
|
|
2333
|
+
if (generator.type === "react" && generator.version === "2") await renderOperations(nodes, {
|
|
2334
|
+
options: plugin.options,
|
|
2335
|
+
resolver,
|
|
2336
|
+
adapter,
|
|
2337
|
+
config,
|
|
2338
|
+
fabric,
|
|
2339
|
+
Component: generator.Operations,
|
|
2340
|
+
plugin,
|
|
2341
|
+
driver
|
|
2342
|
+
});
|
|
2343
|
+
if (generator.type === "core" && generator.version === "2") {
|
|
2344
|
+
const files = await generator.operations?.({
|
|
2345
|
+
nodes,
|
|
2346
|
+
options: plugin.options,
|
|
2347
|
+
resolver,
|
|
2348
|
+
adapter,
|
|
2349
|
+
config,
|
|
2350
|
+
plugin,
|
|
2351
|
+
driver
|
|
2352
|
+
}) ?? [];
|
|
2353
|
+
await fabric.upsertFile(...files);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2252
2357
|
//#endregion
|
|
2253
2358
|
//#region src/storages/memoryStorage.ts
|
|
2254
2359
|
/**
|
|
@@ -2832,6 +2937,9 @@ exports.mergeResolvers = mergeResolvers;
|
|
|
2832
2937
|
exports.renderOperation = renderOperation;
|
|
2833
2938
|
exports.renderOperations = renderOperations;
|
|
2834
2939
|
exports.renderSchema = renderSchema;
|
|
2940
|
+
exports.runGeneratorOperation = runGeneratorOperation;
|
|
2941
|
+
exports.runGeneratorOperations = runGeneratorOperations;
|
|
2942
|
+
exports.runGeneratorSchema = runGeneratorSchema;
|
|
2835
2943
|
exports.safeBuild = safeBuild;
|
|
2836
2944
|
exports.satisfiesDependency = satisfiesDependency;
|
|
2837
2945
|
exports.setup = setup;
|