@kubb/core 5.11.2 → 5.11.4

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.js CHANGED
@@ -1,13 +1,13 @@
1
- import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toError, M as read, N as toPosixPath, O as formatMs, P as write, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as isPathInside, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-DmJSLHWf.js";
1
+ import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as rm, I as write, L as writeRaw, M as isPathInside, N as listFiles, O as formatMs, P as read, R as toError, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as existsSync$1, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-C2bwJUE5.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { isValid } from "verkit";
4
4
  import process$1 from "node:process";
5
5
  import { x } from "tinyexec";
6
- import { glob, readFile, rm } from "node:fs/promises";
6
+ import { readFile } from "node:fs/promises";
7
7
  import path, { join, relative, resolve } from "node:path";
8
+ import { chmodSync, existsSync, mkdirSync } from "node:fs";
8
9
  import { stripVTControlCharacters, styleText } from "node:util";
9
10
  import { hash, randomUUID } from "node:crypto";
10
- import { chmodSync, existsSync, mkdirSync } from "node:fs";
11
11
  import { homedir, tmpdir } from "node:os";
12
12
  import { createInterface } from "node:readline";
13
13
  import { createStorage as createStorage$1 } from "unstorage";
@@ -301,7 +301,7 @@ const fsStorage = createStorage(() => ({
301
301
  name: "fs",
302
302
  async readItem(key) {
303
303
  try {
304
- return await readFile(resolve(key), "utf8");
304
+ return await read(resolve(key));
305
305
  } catch (_error) {
306
306
  return null;
307
307
  }
@@ -319,10 +319,7 @@ const fsStorage = createStorage(() => ({
319
319
  const resolvedBase = resolve(base ?? process.cwd());
320
320
  const keys = [];
321
321
  try {
322
- for await (const entry of glob("**/*", {
323
- cwd: resolvedBase,
324
- withFileTypes: true
325
- })) if (entry.isFile()) keys.push(toPosixPath(relative(resolvedBase, join(entry.parentPath, entry.name))));
322
+ for await (const path of listFiles(resolvedBase)) keys.push(path);
326
323
  } catch (_error) {}
327
324
  return keys;
328
325
  },
@@ -347,7 +344,7 @@ const fsStorage = createStorage(() => ({
347
344
  */
348
345
  function resolveCacheDir(root) {
349
346
  const nodeModules = join(root, "node_modules");
350
- if (existsSync(nodeModules)) return join(nodeModules, ".cache", "kubb");
347
+ if (existsSync$1(nodeModules)) return join(nodeModules, ".cache", "kubb");
351
348
  return join(tmpdir(), "kubb", hash("sha256", root).slice(0, 16));
352
349
  }
353
350
  /**
@@ -368,7 +365,10 @@ const cacheStorage = createStorage(({ root = process.cwd() }) => {
368
365
  return {
369
366
  name: "cache",
370
367
  readItem: (key) => fs.readItem(toPath(key)),
371
- writeItem: (key, value) => fs.writeItem(toPath(key), value),
368
+ async writeItem(key, value) {
369
+ const filePath = toPath(key);
370
+ await writeRaw(filePath, value);
371
+ },
372
372
  removeItem: (key) => fs.removeItem(toPath(key)),
373
373
  readKeys: (base) => fs.readKeys(base ? toPath(base) : dir),
374
374
  empty: async (base) => base ? fs.empty(toPath(base)) : void 0