@kubb/core 5.0.0-beta.97 → 5.0.0-beta.99

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_usingCtx = require("./usingCtx-BLzqdXPG.cjs");
2
+ const require_usingCtx = require("./usingCtx-CZyLSqds.cjs");
3
3
  let node_async_hooks = require("node:async_hooks");
4
4
  let node_util = require("node:util");
5
5
  let node_crypto = require("node:crypto");
@@ -191,7 +191,7 @@ function memoize(store, factory) {
191
191
  }
192
192
  //#endregion
193
193
  //#region package.json
194
- var version = "5.0.0-beta.97";
194
+ var version = "5.0.0-beta.99";
195
195
  //#endregion
196
196
  //#region src/constants.ts
197
197
  /**
@@ -713,7 +713,7 @@ var Diagnostics = class Diagnostics {
713
713
  * since a single-file output has nothing to group.
714
714
  */
715
715
  function normalizeOutput({ output, group, pluginName }) {
716
- const mode = output.mode ?? "directory";
716
+ const mode = output.mode ?? "file";
717
717
  if (mode === "file" && group) throw new Diagnostics.Error({
718
718
  code: diagnosticCode.invalidPluginOptions,
719
719
  severity: "error",
@@ -1029,12 +1029,12 @@ var Resolver = class Resolver {
1029
1029
  return segment ? require_usingCtx.camelCase(segment) : "";
1030
1030
  }
1031
1031
  /**
1032
- * `mode: 'file'` resolves directly to `output.path`. `mode: 'directory'` (default) resolves
1032
+ * `mode: 'file'` (default) resolves directly to `output.path`. `mode: 'directory'` resolves
1033
1033
  * to `output.path/{baseName}`, or into a subdirectory when `group` and a `tag`/`path` value
1034
1034
  * are provided.
1035
1035
  */
1036
1036
  #resolvePath({ baseName, tag, path: groupPath, root, output, group }) {
1037
- if (output.mode === "file") return node_path.default.resolve(root, output.path);
1037
+ if (output.mode !== "directory") return node_path.default.resolve(root, output.path);
1038
1038
  const outputDir = node_path.default.resolve(root, output.path);
1039
1039
  const result = group && (groupPath || tag) ? node_path.default.resolve(outputDir, Resolver.#resolveGroupDir(group, group.type === "path" ? groupPath : tag), baseName) : node_path.default.resolve(outputDir, baseName);
1040
1040
  const outputDirWithSep = outputDir.endsWith(node_path.default.sep) ? outputDir : `${outputDir}${node_path.default.sep}`;
@@ -1510,27 +1510,24 @@ var KubbDriver = class {
1510
1510
  async run() {
1511
1511
  const { hooks, config, fileManager } = this;
1512
1512
  const diagnostics = [];
1513
+ const updateBuffer = [];
1513
1514
  const parsersMap = /* @__PURE__ */ new Map();
1514
1515
  for (const parser of config.parsers) if (parser.extNames) for (const ext of parser.extNames) parsersMap.set(ext, parser);
1515
- const onWriteStart = async (files) => {
1516
- await hooks.callHook("kubb:files:processing:start", { files });
1517
- };
1518
- const updateBuffer = [];
1519
- const onWriteUpdate = (item) => {
1520
- updateBuffer.push(item);
1521
- };
1522
- const onWriteEnd = async (files) => {
1523
- await hooks.callHook("kubb:files:processing:update", { files: updateBuffer.map((item) => ({
1524
- ...item,
1525
- config
1526
- })) });
1527
- updateBuffer.length = 0;
1528
- await hooks.callHook("kubb:files:processing:end", { files });
1529
- };
1530
1516
  const unhookWrites = fileManager.hooks.addHooks({
1531
- start: onWriteStart,
1532
- update: onWriteUpdate,
1533
- end: onWriteEnd
1517
+ start: async (files) => {
1518
+ await hooks.callHook("kubb:files:processing:start", { files });
1519
+ },
1520
+ update: (item) => {
1521
+ updateBuffer.push(item);
1522
+ },
1523
+ end: async (files) => {
1524
+ await hooks.callHook("kubb:files:processing:update", { files: updateBuffer.map((item) => ({
1525
+ ...item,
1526
+ config
1527
+ })) });
1528
+ updateBuffer.length = 0;
1529
+ await hooks.callHook("kubb:files:processing:end", { files });
1530
+ }
1534
1531
  });
1535
1532
  return Diagnostics.scope((diagnostic) => diagnostics.push(diagnostic), async () => {
1536
1533
  try {