@kubb/studio 5.14.5 → 5.15.0
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 +25 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -9
- package/dist/index.d.ts +1 -9
- package/dist/index.js +24 -46
- package/dist/index.js.map +1 -1
- package/dist/{protocol-n7fVO3_7.cjs → protocol-B4wWGPon.cjs} +3 -5
- package/dist/{protocol-n7fVO3_7.cjs.map → protocol-B4wWGPon.cjs.map} +1 -1
- package/dist/{protocol-DQnAN8NE.js → protocol-B6oWLc7W.js} +3 -5
- package/dist/{protocol-DQnAN8NE.js.map → protocol-B6oWLc7W.js.map} +1 -1
- package/dist/{protocol-DQTwqmNO.d.ts → protocol-a0ItUgk9.d.cts} +1 -7
- package/dist/{protocol-DQTwqmNO.d.cts → protocol-a0ItUgk9.d.ts} +1 -7
- package/dist/protocol.cjs +1 -1
- package/dist/protocol.d.cts +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,8 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
const require_protocol = require("./protocol-n7fVO3_7.cjs");
|
|
23
|
+
const require_protocol = require("./protocol-B4wWGPon.cjs");
|
|
25
24
|
let node_crypto = require("node:crypto");
|
|
26
25
|
let node_fs = require("node:fs");
|
|
27
26
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -51,7 +50,7 @@ node_net = __toESM(node_net, 1);
|
|
|
51
50
|
let node_stream = require("node:stream");
|
|
52
51
|
let ofetch = require("ofetch");
|
|
53
52
|
let node_zlib = require("node:zlib");
|
|
54
|
-
|
|
53
|
+
// ../../internals/utils/src/casing.ts
|
|
55
54
|
/**
|
|
56
55
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
57
56
|
* Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
|
|
@@ -66,7 +65,7 @@ function convert(text, pascal) {
|
|
|
66
65
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
67
66
|
}
|
|
68
67
|
const cache = /* @__PURE__ */ new Map();
|
|
69
|
-
const cacheLimit =
|
|
68
|
+
const cacheLimit = 1e5;
|
|
70
69
|
function toCamelOrPascal(text, pascal) {
|
|
71
70
|
const key = `${pascal ? "P" : "c"}${text}`;
|
|
72
71
|
const cached = cache.get(key);
|
|
@@ -88,8 +87,7 @@ function toCamelOrPascal(text, pascal) {
|
|
|
88
87
|
function camelCase(text, { prefix = "", suffix = "" } = {}) {
|
|
89
88
|
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
//#region ../../internals/utils/src/errors.ts
|
|
90
|
+
// ../../internals/utils/src/errors.ts
|
|
93
91
|
/**
|
|
94
92
|
* Coerces an unknown thrown value to an `Error` instance.
|
|
95
93
|
* Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.
|
|
@@ -116,8 +114,7 @@ function toError(value) {
|
|
|
116
114
|
function getErrorMessage(value) {
|
|
117
115
|
return value instanceof Error ? value.message : String(value);
|
|
118
116
|
}
|
|
119
|
-
|
|
120
|
-
//#region ../../internals/utils/src/runtime.ts
|
|
117
|
+
// ../../internals/utils/src/runtime.ts
|
|
121
118
|
const isBun = typeof Bun !== "undefined";
|
|
122
119
|
const isDeno = "Deno" in globalThis;
|
|
123
120
|
/**
|
|
@@ -146,8 +143,7 @@ function detect() {
|
|
|
146
143
|
version: process.versions?.node ?? ""
|
|
147
144
|
};
|
|
148
145
|
}
|
|
149
|
-
|
|
150
|
-
//#region ../../internals/utils/src/fs.ts
|
|
146
|
+
// ../../internals/utils/src/fs.ts
|
|
151
147
|
/**
|
|
152
148
|
* Reads the file at `path` as a UTF-8 string.
|
|
153
149
|
* Uses `Bun.file().text()` when running under Bun, `fs.readFile` otherwise.
|
|
@@ -203,8 +199,7 @@ function isPathInside(path, parent) {
|
|
|
203
199
|
const rel = (0, node_path.relative)(resolvedParent, resolvedPath);
|
|
204
200
|
return rel !== "" && !rel.startsWith("..") && !(0, node_path.isAbsolute)(rel);
|
|
205
201
|
}
|
|
206
|
-
|
|
207
|
-
//#region ../../internals/utils/src/promise.ts
|
|
202
|
+
// ../../internals/utils/src/promise.ts
|
|
208
203
|
/**
|
|
209
204
|
* Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each
|
|
210
205
|
* takes the next item the moment it frees up instead of waiting for a batch to drain.
|
|
@@ -221,8 +216,7 @@ async function inParallel({ items, limit, run }) {
|
|
|
221
216
|
};
|
|
222
217
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
223
218
|
}
|
|
224
|
-
|
|
225
|
-
//#region ../../internals/utils/src/time.ts
|
|
219
|
+
// ../../internals/utils/src/time.ts
|
|
226
220
|
/**
|
|
227
221
|
* Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.
|
|
228
222
|
* Rounds to 2 decimal places for sub-millisecond precision without noise.
|
|
@@ -239,11 +233,9 @@ function getElapsedMs(hrStart) {
|
|
|
239
233
|
const ms = seconds * 1e3 + nanoseconds / 1e6;
|
|
240
234
|
return Math.round(ms * 100) / 100;
|
|
241
235
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region ../../internals/shared/src/constants.ts
|
|
236
|
+
// package.json
|
|
237
|
+
var version = "5.15.0";
|
|
238
|
+
// ../../internals/shared/src/constants.ts
|
|
247
239
|
/**
|
|
248
240
|
* Extensions `kubb` ships at its own version, so they count as installed without being a direct
|
|
249
241
|
* dependency. `constants.test.ts` checks it against the `kubb` package's dependencies.
|
|
@@ -254,8 +246,7 @@ const BUNDLED_PACKAGES = [
|
|
|
254
246
|
"@kubb/parser-md",
|
|
255
247
|
"@kubb/plugin-barrel"
|
|
256
248
|
];
|
|
257
|
-
|
|
258
|
-
//#region ../../internals/shared/src/configFile/ast.ts
|
|
249
|
+
// ../../internals/shared/src/configFile/ast.ts
|
|
259
250
|
/** Node types the config editor reads from the yuku AST. */
|
|
260
251
|
const nodeTypes = {
|
|
261
252
|
arrayExpression: "ArrayExpression",
|
|
@@ -316,8 +307,7 @@ function parseExpression(source) {
|
|
|
316
307
|
const [statement] = parsed.program.body;
|
|
317
308
|
return parsed.program.body.length === 1 && statement?.type === nodeTypes.expressionStatement ? statement.expression : void 0;
|
|
318
309
|
}
|
|
319
|
-
|
|
320
|
-
//#region ../../internals/shared/src/configFile/rules.ts
|
|
310
|
+
// ../../internals/shared/src/configFile/rules.ts
|
|
321
311
|
/** `@kubb/plugin-ts` becomes `plugin-ts`, the `name` Kubb plugin factories use. */
|
|
322
312
|
function toPluginName(packageName) {
|
|
323
313
|
return packageName.split("/").pop() ?? packageName;
|
|
@@ -381,8 +371,7 @@ function isOutputValue({ key, value }) {
|
|
|
381
371
|
function pickOutput(output) {
|
|
382
372
|
return Object.fromEntries(Object.entries(output).filter(([key]) => isOutputKey(key)));
|
|
383
373
|
}
|
|
384
|
-
|
|
385
|
-
//#region ../../internals/shared/src/configFile/text.ts
|
|
374
|
+
// ../../internals/shared/src/configFile/text.ts
|
|
386
375
|
/**
|
|
387
376
|
* A valid JavaScript identifier, so an import name can only ever print as `import { name } from`,
|
|
388
377
|
* never as source that breaks out of the import statement.
|
|
@@ -454,8 +443,7 @@ function removeItem(source, node, index) {
|
|
|
454
443
|
const next = items[index + 1];
|
|
455
444
|
return next ? replaceText(source, start, next.start) : replaceText(source, items[index - 1].end, end);
|
|
456
445
|
}
|
|
457
|
-
|
|
458
|
-
//#region ../../internals/shared/src/configFile/configFile.ts
|
|
446
|
+
// ../../internals/shared/src/configFile/configFile.ts
|
|
459
447
|
/** The marker `disable-plugin` writes, with the block's line count so `enable-plugin` restores exactly those lines. */
|
|
460
448
|
const DISABLED_MARKER_PATTERN = /^kubb:disabled (.+)\s+(\d+)$/;
|
|
461
449
|
const OPERATIONS = new Set(Object.values(require_protocol.ConfigEditOperation));
|
|
@@ -1189,8 +1177,7 @@ async function editConfigFile({ filePath, edits, extensions }) {
|
|
|
1189
1177
|
if (result.changed) await writeRaw(filePath, result.source);
|
|
1190
1178
|
return result;
|
|
1191
1179
|
}
|
|
1192
|
-
|
|
1193
|
-
//#region src/diff.ts
|
|
1180
|
+
// src/diff.ts
|
|
1194
1181
|
const CONTEXT_LINES = 3;
|
|
1195
1182
|
const DIFF_TIMEOUT_MS = 1e3;
|
|
1196
1183
|
const splitLines = (text) => text === "" ? [] : text.split(/(?<=\n)/);
|
|
@@ -1342,8 +1329,7 @@ function pageHunks({ hunks, cursor, limit }) {
|
|
|
1342
1329
|
nextCursor: cursor + used < total ? cursor + used : null
|
|
1343
1330
|
};
|
|
1344
1331
|
}
|
|
1345
|
-
|
|
1346
|
-
//#region src/generations.ts
|
|
1332
|
+
// src/generations.ts
|
|
1347
1333
|
const READ_CONCURRENCY = 50;
|
|
1348
1334
|
const MB = 1048576;
|
|
1349
1335
|
const INDEX_KEY = "studio/generations.json";
|
|
@@ -1598,8 +1584,7 @@ function createGenerationStore({ storage, maxCount, maxMb, ttlMs, now = Date.now
|
|
|
1598
1584
|
}
|
|
1599
1585
|
};
|
|
1600
1586
|
}
|
|
1601
|
-
|
|
1602
|
-
//#region src/generationEvents.ts
|
|
1587
|
+
// src/generationEvents.ts
|
|
1603
1588
|
const MAX_QUEUED_EVENTS = 1024;
|
|
1604
1589
|
const RESERVED_EVENTS = 64;
|
|
1605
1590
|
const isDiscardable = (type) => type === "kubb:files:processing:update" || type === "kubb:info" || type === "kubb:success";
|
|
@@ -1781,8 +1766,7 @@ function createGenerationStream(hooks, jobId) {
|
|
|
1781
1766
|
fail
|
|
1782
1767
|
};
|
|
1783
1768
|
}
|
|
1784
|
-
|
|
1785
|
-
//#region src/publicFetch.ts
|
|
1769
|
+
// src/publicFetch.ts
|
|
1786
1770
|
const MAX_REDIRECTS = 5;
|
|
1787
1771
|
const MAX_BYTES = 52428800;
|
|
1788
1772
|
const REDIRECTS = /* @__PURE__ */ new Set([
|
|
@@ -1881,8 +1865,7 @@ async function withPublicFetch(run) {
|
|
|
1881
1865
|
globalThis.fetch = original;
|
|
1882
1866
|
}
|
|
1883
1867
|
}
|
|
1884
|
-
|
|
1885
|
-
//#region src/resolveConfig.ts
|
|
1868
|
+
// src/resolveConfig.ts
|
|
1886
1869
|
/**
|
|
1887
1870
|
* Turns the JSON config Studio sends back into live Kubb objects.
|
|
1888
1871
|
*
|
|
@@ -2206,8 +2189,7 @@ async function mergeParsers({ diskParsers, studioParsers, extensions = /* @__PUR
|
|
|
2206
2189
|
extensions
|
|
2207
2190
|
})));
|
|
2208
2191
|
}
|
|
2209
|
-
|
|
2210
|
-
//#region src/url.ts
|
|
2192
|
+
// src/url.ts
|
|
2211
2193
|
/**
|
|
2212
2194
|
* Hosted Kubb Studio URL, used when a host passes none.
|
|
2213
2195
|
*/
|
|
@@ -2234,8 +2216,7 @@ function secureUrl({ studioUrl, path, socket = false }) {
|
|
|
2234
2216
|
if (socket) url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
2235
2217
|
return url;
|
|
2236
2218
|
}
|
|
2237
|
-
|
|
2238
|
-
//#region src/connect.ts
|
|
2219
|
+
// src/connect.ts
|
|
2239
2220
|
const HEARTBEAT_INTERVAL_MS = 3e4;
|
|
2240
2221
|
const MAX_HEARTBEAT_INTERVAL_MS = 6e4;
|
|
2241
2222
|
const PING_TIMEOUT_MS = 1e4;
|
|
@@ -3215,8 +3196,7 @@ function connectAgent(options) {
|
|
|
3215
3196
|
openRpc: openWebSocketRpc
|
|
3216
3197
|
});
|
|
3217
3198
|
}
|
|
3218
|
-
|
|
3219
|
-
//#region src/pair.ts
|
|
3199
|
+
// src/pair.ts
|
|
3220
3200
|
/** Labels, not secrets: a person approving the code in the browser is what authorizes a pairing. */
|
|
3221
3201
|
const CLIENT_IDS = {
|
|
3222
3202
|
cli: "kubb-cli",
|
|
@@ -3365,8 +3345,7 @@ async function pairAgent({ onCode, onRetry, maxAttempts = 1, ...options }) {
|
|
|
3365
3345
|
}
|
|
3366
3346
|
}
|
|
3367
3347
|
}
|
|
3368
|
-
|
|
3369
|
-
//#region src/snapshot.ts
|
|
3348
|
+
// src/snapshot.ts
|
|
3370
3349
|
const UPLOAD_TIMEOUT_MS = 12e4;
|
|
3371
3350
|
const BUNDLED_DEPENDENCIES = ["@kubb/plugin-barrel"];
|
|
3372
3351
|
/**
|
|
@@ -3614,7 +3593,6 @@ async function createSnapshot({ studioUrl = defaultStudioUrl, apiKey, config, ho
|
|
|
3614
3593
|
});
|
|
3615
3594
|
return _data.snapshot;
|
|
3616
3595
|
}
|
|
3617
|
-
//#endregion
|
|
3618
3596
|
exports.IncompatibleAgentError = IncompatibleAgentError;
|
|
3619
3597
|
exports.InvalidAgentTokenError = InvalidAgentTokenError;
|
|
3620
3598
|
exports.PairingCanceledError = PairingCanceledError;
|