@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.cjs
CHANGED
|
@@ -155,7 +155,7 @@ function detect() {
|
|
|
155
155
|
*/
|
|
156
156
|
async function read(path) {
|
|
157
157
|
if (runtime.isBun) return Bun.file(path).text();
|
|
158
|
-
return (0,
|
|
158
|
+
return new Promise((resolvePromise, reject) => (0, node_fs.readFile)(path, { encoding: "utf8" }, (error, data) => error ? reject(error) : resolvePromise(data)));
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Writes UTF-8 content verbatim, including empty files and surrounding whitespace.
|
|
@@ -171,11 +171,11 @@ async function writeRaw(path, content) {
|
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
|
-
await (0,
|
|
174
|
+
await new Promise((resolvePromise, reject) => (0, node_fs.writeFile)(resolved, content, { encoding: "utf-8" }, (error) => error ? reject(error) : resolvePromise()));
|
|
175
175
|
} catch (error) {
|
|
176
176
|
if (error.code !== "ENOENT") throw error;
|
|
177
177
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(resolved), { recursive: true });
|
|
178
|
-
await (0,
|
|
178
|
+
await new Promise((resolvePromise, reject) => (0, node_fs.writeFile)(resolved, content, { encoding: "utf-8" }, (error) => error ? reject(error) : resolvePromise()));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
@@ -201,6 +201,41 @@ function isPathInside(path, parent) {
|
|
|
201
201
|
}
|
|
202
202
|
// ../../internals/utils/src/promise.ts
|
|
203
203
|
/**
|
|
204
|
+
* Returns the value cached under `key` in `store`, computing and storing it on the first call.
|
|
205
|
+
* Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive
|
|
206
|
+
* keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* `const refs = memo(refCache, node, () => collectRefs(node))`
|
|
210
|
+
*/
|
|
211
|
+
function memo(store, key, compute) {
|
|
212
|
+
const cached = store.get(key);
|
|
213
|
+
if (cached !== void 0 || store.has(key)) return cached;
|
|
214
|
+
const value = compute();
|
|
215
|
+
store.set(key, value);
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
function createStore({ type }) {
|
|
219
|
+
if (type === "weak") return /* @__PURE__ */ new WeakMap();
|
|
220
|
+
const entry = /* @__PURE__ */ new Map();
|
|
221
|
+
if (type === "map") return entry;
|
|
222
|
+
const set = (key, value) => {
|
|
223
|
+
entry.clear();
|
|
224
|
+
entry.set(key, value);
|
|
225
|
+
};
|
|
226
|
+
const touch = (key) => {
|
|
227
|
+
if (!entry.has(key)) return false;
|
|
228
|
+
set(key, entry.get(key));
|
|
229
|
+
return true;
|
|
230
|
+
};
|
|
231
|
+
return {
|
|
232
|
+
has: touch,
|
|
233
|
+
get: (key) => touch(key) ? entry.get(key) : void 0,
|
|
234
|
+
set
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
memo.create = createStore;
|
|
238
|
+
/**
|
|
204
239
|
* Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each
|
|
205
240
|
* takes the next item the moment it frees up instead of waiting for a batch to drain.
|
|
206
241
|
*
|
|
@@ -217,7 +252,7 @@ async function inParallel({ items, limit, run }) {
|
|
|
217
252
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
218
253
|
}
|
|
219
254
|
// package.json
|
|
220
|
-
var version = "5.18.
|
|
255
|
+
var version = "5.18.8";
|
|
221
256
|
// ../../internals/shared/src/constants.ts
|
|
222
257
|
/**
|
|
223
258
|
* Extensions `kubb` ships at its own version, so they count as installed without being a direct
|