@kubb/core 5.0.0-beta.14 → 5.0.0-beta.15
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/index.cjs +8 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/createKubb.ts +10 -14
- package/src/storages/fsStorage.ts +7 -6
package/dist/index.js
CHANGED
|
@@ -525,7 +525,7 @@ function createAdapter(build) {
|
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region package.json
|
|
528
|
-
var version$1 = "5.0.0-beta.
|
|
528
|
+
var version$1 = "5.0.0-beta.15";
|
|
529
529
|
//#endregion
|
|
530
530
|
//#region src/createStorage.ts
|
|
531
531
|
/**
|
|
@@ -790,9 +790,8 @@ const fsStorage = createStorage(() => ({
|
|
|
790
790
|
await rm(resolve(key), { force: true });
|
|
791
791
|
},
|
|
792
792
|
async getKeys(base) {
|
|
793
|
-
const keys = [];
|
|
794
793
|
const resolvedBase = resolve(base ?? process.cwd());
|
|
795
|
-
async function walk(dir, prefix) {
|
|
794
|
+
async function* walk(dir, prefix) {
|
|
796
795
|
let entries;
|
|
797
796
|
try {
|
|
798
797
|
entries = await readdir(dir, { withFileTypes: true });
|
|
@@ -801,11 +800,12 @@ const fsStorage = createStorage(() => ({
|
|
|
801
800
|
}
|
|
802
801
|
for (const entry of entries) {
|
|
803
802
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
804
|
-
if (entry.isDirectory())
|
|
805
|
-
else
|
|
803
|
+
if (entry.isDirectory()) yield* walk(join(dir, entry.name), rel);
|
|
804
|
+
else yield rel;
|
|
806
805
|
}
|
|
807
806
|
}
|
|
808
|
-
|
|
807
|
+
const keys = [];
|
|
808
|
+
for await (const key of walk(resolvedBase, "")) keys.push(key);
|
|
809
809
|
return keys;
|
|
810
810
|
},
|
|
811
811
|
async clear(base) {
|
|
@@ -1006,10 +1006,7 @@ async function runPluginAstHooks(plugin, context) {
|
|
|
1006
1006
|
...generatorContext,
|
|
1007
1007
|
options
|
|
1008
1008
|
};
|
|
1009
|
-
|
|
1010
|
-
if (!gen.schema) continue;
|
|
1011
|
-
await applyHookResult(await gen.schema(transformedNode, ctx), driver, resolveRenderer(gen));
|
|
1012
|
-
}
|
|
1009
|
+
await Promise.all(generators.filter((gen) => gen.schema).map((gen) => Promise.resolve(gen.schema(transformedNode, ctx)).then((result) => applyHookResult(result, driver, resolveRenderer(gen)))));
|
|
1013
1010
|
await driver.hooks.emit("kubb:generate:schema", transformedNode, ctx);
|
|
1014
1011
|
},
|
|
1015
1012
|
async operation(node) {
|
|
@@ -1026,10 +1023,7 @@ async function runPluginAstHooks(plugin, context) {
|
|
|
1026
1023
|
...generatorContext,
|
|
1027
1024
|
options
|
|
1028
1025
|
};
|
|
1029
|
-
|
|
1030
|
-
if (!gen.operation) continue;
|
|
1031
|
-
await applyHookResult(await gen.operation(transformedNode, ctx), driver, resolveRenderer(gen));
|
|
1032
|
-
}
|
|
1026
|
+
await Promise.all(generators.filter((gen) => gen.operation).map((gen) => Promise.resolve(gen.operation(transformedNode, ctx)).then((result) => applyHookResult(result, driver, resolveRenderer(gen)))));
|
|
1033
1027
|
await driver.hooks.emit("kubb:generate:operation", transformedNode, ctx);
|
|
1034
1028
|
}
|
|
1035
1029
|
}
|
|
@@ -1125,7 +1119,6 @@ async function safeBuild(setupResult) {
|
|
|
1125
1119
|
},
|
|
1126
1120
|
upsertFile: (...files) => driver.fileManager.upsert(...files)
|
|
1127
1121
|
});
|
|
1128
|
-
await flushPendingFiles();
|
|
1129
1122
|
await hooks.emit("kubb:debug", {
|
|
1130
1123
|
date: /* @__PURE__ */ new Date(),
|
|
1131
1124
|
logs: [`✓ Plugin started successfully (${formatMs(duration)})`]
|
|
@@ -1145,7 +1138,6 @@ async function safeBuild(setupResult) {
|
|
|
1145
1138
|
},
|
|
1146
1139
|
upsertFile: (...files) => driver.fileManager.upsert(...files)
|
|
1147
1140
|
});
|
|
1148
|
-
await flushPendingFiles();
|
|
1149
1141
|
await hooks.emit("kubb:debug", {
|
|
1150
1142
|
date: errorTimestamp,
|
|
1151
1143
|
logs: [
|