@kubb/studio 5.18.7 → 5.18.8
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 +39 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as AgentPermission, c as MAX_SNAPSHOT_BYTES, d as extensionKinds, i as AgentMessage, l as generationEventTypes, n as AGENT_SOCKET_PATH, r as AgentCloseCode, t as AGENT_INSTANCE_HEADER, u as ConfigEditOperation } from "./protocol-B6oWLc7W.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, hash, randomUUID } from "node:crypto";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
|
-
import { mkdir, mkdir as mkdir$1, mkdtemp,
|
|
4
|
+
import { existsSync, readFile, writeFile } from "node:fs";
|
|
5
|
+
import { mkdir, mkdir as mkdir$1, mkdtemp, rm, writeFile as writeFile$1 } from "node:fs/promises";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import path, { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
import process$1 from "node:process";
|
|
@@ -127,7 +127,7 @@ function detect() {
|
|
|
127
127
|
*/
|
|
128
128
|
async function read(path) {
|
|
129
129
|
if (runtime.isBun) return Bun.file(path).text();
|
|
130
|
-
return readFile(path, { encoding: "utf8" });
|
|
130
|
+
return new Promise((resolvePromise, reject) => readFile(path, { encoding: "utf8" }, (error, data) => error ? reject(error) : resolvePromise(data)));
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* Writes UTF-8 content verbatim, including empty files and surrounding whitespace.
|
|
@@ -143,11 +143,11 @@ async function writeRaw(path, content) {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
try {
|
|
146
|
-
await writeFile(resolved, content, { encoding: "utf-8" });
|
|
146
|
+
await new Promise((resolvePromise, reject) => writeFile(resolved, content, { encoding: "utf-8" }, (error) => error ? reject(error) : resolvePromise()));
|
|
147
147
|
} catch (error) {
|
|
148
148
|
if (error.code !== "ENOENT") throw error;
|
|
149
149
|
await mkdir$1(dirname(resolved), { recursive: true });
|
|
150
|
-
await writeFile(resolved, content, { encoding: "utf-8" });
|
|
150
|
+
await new Promise((resolvePromise, reject) => writeFile(resolved, content, { encoding: "utf-8" }, (error) => error ? reject(error) : resolvePromise()));
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
@@ -173,6 +173,41 @@ function isPathInside(path, parent) {
|
|
|
173
173
|
}
|
|
174
174
|
// ../../internals/utils/src/promise.ts
|
|
175
175
|
/**
|
|
176
|
+
* Returns the value cached under `key` in `store`, computing and storing it on the first call.
|
|
177
|
+
* Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive
|
|
178
|
+
* keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* `const refs = memo(refCache, node, () => collectRefs(node))`
|
|
182
|
+
*/
|
|
183
|
+
function memo(store, key, compute) {
|
|
184
|
+
const cached = store.get(key);
|
|
185
|
+
if (cached !== void 0 || store.has(key)) return cached;
|
|
186
|
+
const value = compute();
|
|
187
|
+
store.set(key, value);
|
|
188
|
+
return value;
|
|
189
|
+
}
|
|
190
|
+
function createStore({ type }) {
|
|
191
|
+
if (type === "weak") return /* @__PURE__ */ new WeakMap();
|
|
192
|
+
const entry = /* @__PURE__ */ new Map();
|
|
193
|
+
if (type === "map") return entry;
|
|
194
|
+
const set = (key, value) => {
|
|
195
|
+
entry.clear();
|
|
196
|
+
entry.set(key, value);
|
|
197
|
+
};
|
|
198
|
+
const touch = (key) => {
|
|
199
|
+
if (!entry.has(key)) return false;
|
|
200
|
+
set(key, entry.get(key));
|
|
201
|
+
return true;
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
has: touch,
|
|
205
|
+
get: (key) => touch(key) ? entry.get(key) : void 0,
|
|
206
|
+
set
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
memo.create = createStore;
|
|
210
|
+
/**
|
|
176
211
|
* Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each
|
|
177
212
|
* takes the next item the moment it frees up instead of waiting for a batch to drain.
|
|
178
213
|
*
|
|
@@ -189,7 +224,7 @@ async function inParallel({ items, limit, run }) {
|
|
|
189
224
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
190
225
|
}
|
|
191
226
|
// package.json
|
|
192
|
-
var version = "5.18.
|
|
227
|
+
var version = "5.18.8";
|
|
193
228
|
// ../../internals/shared/src/constants.ts
|
|
194
229
|
/**
|
|
195
230
|
* Extensions `kubb` ships at its own version, so they count as installed without being a direct
|
|
@@ -2627,7 +2662,7 @@ var Agent = class extends RpcTarget {
|
|
|
2627
2662
|
let wroteDocument = false;
|
|
2628
2663
|
for (const [index, edit] of kept.entries()) {
|
|
2629
2664
|
if (!("document" in edit) || !edit.document || !outcomes[index].applied) continue;
|
|
2630
|
-
await writeFile(path.join(this.#options.root, edit.document.fileName), edit.document.text, "utf-8");
|
|
2665
|
+
await writeFile$1(path.join(this.#options.root, edit.document.fileName), edit.document.text, "utf-8");
|
|
2631
2666
|
wroteDocument = true;
|
|
2632
2667
|
}
|
|
2633
2668
|
const changed = written.changed || wroteDocument;
|