@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.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- import { B as SnapshotUploadMetadata, G as editConfig, K as editConfigFile, O as PublishedSnapshot, a as AgentConnectInfo, c as AgentPermissions, s as AgentPermission } from "./protocol-DQTwqmNO.cjs";
1
+ import { B as SnapshotUploadMetadata, G as editConfig, K as editConfigFile, O as PublishedSnapshot, a as AgentConnectInfo, c as AgentPermissions, s as AgentPermission } from "./protocol-a0ItUgk9.cjs";
2
2
  import { Config, Hookable, KubbHooks } from "@kubb/core";
3
- //#region src/connect.d.ts
4
3
  /**
5
4
  * Studio closed with {@link AgentCloseCode.UNAUTHORIZED}. Hosts forget the token and pair again.
6
5
  */
@@ -129,8 +128,6 @@ type ConnectAgentOptions = {
129
128
  * ```
130
129
  */
131
130
  export declare function connectAgent(options: ConnectAgentOptions): Promise<void>;
132
- //#endregion
133
- //#region src/pair.d.ts
134
131
  /**
135
132
  * RFC 8628 device-authorization response from Studio's `/api/auth/device/code` endpoint.
136
133
  * Field names match the RFC; the CLI polls with `device_code` and shows `user_code` to the user.
@@ -221,8 +218,6 @@ type PairAgentOptions = StartPairingOptions & {
221
218
  * Pairs this machine with Studio: asks for a code, hands it to the host to show, and waits for approval.
222
219
  */
223
220
  export declare function pairAgent({ onCode, onRetry, maxAttempts, ...options }: PairAgentOptions): Promise<PairingResult>;
224
- //#endregion
225
- //#region src/snapshot.d.ts
226
221
  type CreateSnapshotOptions = Omit<SnapshotUploadMetadata, 'hashes' | 'peerDependencies'> & {
227
222
  studioUrl?: string;
228
223
  /**
@@ -245,12 +240,9 @@ type CreateSnapshotOptions = Omit<SnapshotUploadMetadata, 'hashes' | 'peerDepend
245
240
  * ```
246
241
  */
247
242
  export declare function createSnapshot({ studioUrl, apiKey, config, hooks, signal, ...metadata }: CreateSnapshotOptions): Promise<PublishedSnapshot>;
248
- //#endregion
249
- //#region src/url.d.ts
250
243
  /**
251
244
  * Hosted Kubb Studio URL, used when a host passes none.
252
245
  */
253
246
  export declare const defaultStudioUrl = "https://kubb.studio";
254
- //#endregion
255
247
  export { type ConnectAgentOptions, type StudioConnectedContext, editConfig, editConfigFile };
256
248
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { B as SnapshotUploadMetadata, G as editConfig, K as editConfigFile, O as PublishedSnapshot, a as AgentConnectInfo, c as AgentPermissions, s as AgentPermission } from "./protocol-DQTwqmNO.js";
1
+ import { B as SnapshotUploadMetadata, G as editConfig, K as editConfigFile, O as PublishedSnapshot, a as AgentConnectInfo, c as AgentPermissions, s as AgentPermission } from "./protocol-a0ItUgk9.js";
2
2
  import { Config, Hookable, KubbHooks } from "@kubb/core";
3
- //#region src/connect.d.ts
4
3
  /**
5
4
  * Studio closed with {@link AgentCloseCode.UNAUTHORIZED}. Hosts forget the token and pair again.
6
5
  */
@@ -129,8 +128,6 @@ type ConnectAgentOptions = {
129
128
  * ```
130
129
  */
131
130
  export declare function connectAgent(options: ConnectAgentOptions): Promise<void>;
132
- //#endregion
133
- //#region src/pair.d.ts
134
131
  /**
135
132
  * RFC 8628 device-authorization response from Studio's `/api/auth/device/code` endpoint.
136
133
  * Field names match the RFC; the CLI polls with `device_code` and shows `user_code` to the user.
@@ -221,8 +218,6 @@ type PairAgentOptions = StartPairingOptions & {
221
218
  * Pairs this machine with Studio: asks for a code, hands it to the host to show, and waits for approval.
222
219
  */
223
220
  export declare function pairAgent({ onCode, onRetry, maxAttempts, ...options }: PairAgentOptions): Promise<PairingResult>;
224
- //#endregion
225
- //#region src/snapshot.d.ts
226
221
  type CreateSnapshotOptions = Omit<SnapshotUploadMetadata, 'hashes' | 'peerDependencies'> & {
227
222
  studioUrl?: string;
228
223
  /**
@@ -245,12 +240,9 @@ type CreateSnapshotOptions = Omit<SnapshotUploadMetadata, 'hashes' | 'peerDepend
245
240
  * ```
246
241
  */
247
242
  export declare function createSnapshot({ studioUrl, apiKey, config, hooks, signal, ...metadata }: CreateSnapshotOptions): Promise<PublishedSnapshot>;
248
- //#endregion
249
- //#region src/url.d.ts
250
243
  /**
251
244
  * Hosted Kubb Studio URL, used when a host passes none.
252
245
  */
253
246
  export declare const defaultStudioUrl = "https://kubb.studio";
254
- //#endregion
255
247
  export { type ConnectAgentOptions, type StudioConnectedContext, editConfig, editConfigFile };
256
248
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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-DQnAN8NE.js";
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
4
  import { existsSync } from "node:fs";
@@ -22,8 +22,7 @@ import net from "node:net";
22
22
  import { Readable, Transform } from "node:stream";
23
23
  import { ofetch } from "ofetch";
24
24
  import { gzipSync } from "node:zlib";
25
- //#endregion
26
- //#region ../../internals/utils/src/casing.ts
25
+ // ../../internals/utils/src/casing.ts
27
26
  /**
28
27
  * Shared implementation for camelCase and PascalCase conversion.
29
28
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -38,7 +37,7 @@ function convert(text, pascal) {
38
37
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
39
38
  }
40
39
  const cache = /* @__PURE__ */ new Map();
41
- const cacheLimit = 1e4;
40
+ const cacheLimit = 1e5;
42
41
  function toCamelOrPascal(text, pascal) {
43
42
  const key = `${pascal ? "P" : "c"}${text}`;
44
43
  const cached = cache.get(key);
@@ -60,8 +59,7 @@ function toCamelOrPascal(text, pascal) {
60
59
  function camelCase(text, { prefix = "", suffix = "" } = {}) {
61
60
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
62
61
  }
63
- //#endregion
64
- //#region ../../internals/utils/src/errors.ts
62
+ // ../../internals/utils/src/errors.ts
65
63
  /**
66
64
  * Coerces an unknown thrown value to an `Error` instance.
67
65
  * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.
@@ -88,8 +86,7 @@ function toError(value) {
88
86
  function getErrorMessage(value) {
89
87
  return value instanceof Error ? value.message : String(value);
90
88
  }
91
- //#endregion
92
- //#region ../../internals/utils/src/runtime.ts
89
+ // ../../internals/utils/src/runtime.ts
93
90
  const isBun = typeof Bun !== "undefined";
94
91
  const isDeno = "Deno" in globalThis;
95
92
  /**
@@ -118,8 +115,7 @@ function detect() {
118
115
  version: process.versions?.node ?? ""
119
116
  };
120
117
  }
121
- //#endregion
122
- //#region ../../internals/utils/src/fs.ts
118
+ // ../../internals/utils/src/fs.ts
123
119
  /**
124
120
  * Reads the file at `path` as a UTF-8 string.
125
121
  * Uses `Bun.file().text()` when running under Bun, `fs.readFile` otherwise.
@@ -175,8 +171,7 @@ function isPathInside(path, parent) {
175
171
  const rel = relative(resolvedParent, resolvedPath);
176
172
  return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
177
173
  }
178
- //#endregion
179
- //#region ../../internals/utils/src/promise.ts
174
+ // ../../internals/utils/src/promise.ts
180
175
  /**
181
176
  * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each
182
177
  * takes the next item the moment it frees up instead of waiting for a batch to drain.
@@ -193,8 +188,7 @@ async function inParallel({ items, limit, run }) {
193
188
  };
194
189
  await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
195
190
  }
196
- //#endregion
197
- //#region ../../internals/utils/src/time.ts
191
+ // ../../internals/utils/src/time.ts
198
192
  /**
199
193
  * Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.
200
194
  * Rounds to 2 decimal places for sub-millisecond precision without noise.
@@ -211,11 +205,9 @@ function getElapsedMs(hrStart) {
211
205
  const ms = seconds * 1e3 + nanoseconds / 1e6;
212
206
  return Math.round(ms * 100) / 100;
213
207
  }
214
- //#endregion
215
- //#region package.json
216
- var version = "5.14.5";
217
- //#endregion
218
- //#region ../../internals/shared/src/constants.ts
208
+ // package.json
209
+ var version = "5.15.0";
210
+ // ../../internals/shared/src/constants.ts
219
211
  /**
220
212
  * Extensions `kubb` ships at its own version, so they count as installed without being a direct
221
213
  * dependency. `constants.test.ts` checks it against the `kubb` package's dependencies.
@@ -226,8 +218,7 @@ const BUNDLED_PACKAGES = [
226
218
  "@kubb/parser-md",
227
219
  "@kubb/plugin-barrel"
228
220
  ];
229
- //#endregion
230
- //#region ../../internals/shared/src/configFile/ast.ts
221
+ // ../../internals/shared/src/configFile/ast.ts
231
222
  /** Node types the config editor reads from the yuku AST. */
232
223
  const nodeTypes = {
233
224
  arrayExpression: "ArrayExpression",
@@ -288,8 +279,7 @@ function parseExpression(source) {
288
279
  const [statement] = parsed.program.body;
289
280
  return parsed.program.body.length === 1 && statement?.type === nodeTypes.expressionStatement ? statement.expression : void 0;
290
281
  }
291
- //#endregion
292
- //#region ../../internals/shared/src/configFile/rules.ts
282
+ // ../../internals/shared/src/configFile/rules.ts
293
283
  /** `@kubb/plugin-ts` becomes `plugin-ts`, the `name` Kubb plugin factories use. */
294
284
  function toPluginName(packageName) {
295
285
  return packageName.split("/").pop() ?? packageName;
@@ -353,8 +343,7 @@ function isOutputValue({ key, value }) {
353
343
  function pickOutput(output) {
354
344
  return Object.fromEntries(Object.entries(output).filter(([key]) => isOutputKey(key)));
355
345
  }
356
- //#endregion
357
- //#region ../../internals/shared/src/configFile/text.ts
346
+ // ../../internals/shared/src/configFile/text.ts
358
347
  /**
359
348
  * A valid JavaScript identifier, so an import name can only ever print as `import { name } from`,
360
349
  * never as source that breaks out of the import statement.
@@ -426,8 +415,7 @@ function removeItem(source, node, index) {
426
415
  const next = items[index + 1];
427
416
  return next ? replaceText(source, start, next.start) : replaceText(source, items[index - 1].end, end);
428
417
  }
429
- //#endregion
430
- //#region ../../internals/shared/src/configFile/configFile.ts
418
+ // ../../internals/shared/src/configFile/configFile.ts
431
419
  /** The marker `disable-plugin` writes, with the block's line count so `enable-plugin` restores exactly those lines. */
432
420
  const DISABLED_MARKER_PATTERN = /^kubb:disabled (.+)\s+(\d+)$/;
433
421
  const OPERATIONS = new Set(Object.values(ConfigEditOperation));
@@ -1161,8 +1149,7 @@ async function editConfigFile({ filePath, edits, extensions }) {
1161
1149
  if (result.changed) await writeRaw(filePath, result.source);
1162
1150
  return result;
1163
1151
  }
1164
- //#endregion
1165
- //#region src/diff.ts
1152
+ // src/diff.ts
1166
1153
  const CONTEXT_LINES = 3;
1167
1154
  const DIFF_TIMEOUT_MS = 1e3;
1168
1155
  const splitLines = (text) => text === "" ? [] : text.split(/(?<=\n)/);
@@ -1314,8 +1301,7 @@ function pageHunks({ hunks, cursor, limit }) {
1314
1301
  nextCursor: cursor + used < total ? cursor + used : null
1315
1302
  };
1316
1303
  }
1317
- //#endregion
1318
- //#region src/generations.ts
1304
+ // src/generations.ts
1319
1305
  const READ_CONCURRENCY = 50;
1320
1306
  const MB = 1048576;
1321
1307
  const INDEX_KEY = "studio/generations.json";
@@ -1570,8 +1556,7 @@ function createGenerationStore({ storage, maxCount, maxMb, ttlMs, now = Date.now
1570
1556
  }
1571
1557
  };
1572
1558
  }
1573
- //#endregion
1574
- //#region src/generationEvents.ts
1559
+ // src/generationEvents.ts
1575
1560
  const MAX_QUEUED_EVENTS = 1024;
1576
1561
  const RESERVED_EVENTS = 64;
1577
1562
  const isDiscardable = (type) => type === "kubb:files:processing:update" || type === "kubb:info" || type === "kubb:success";
@@ -1753,8 +1738,7 @@ function createGenerationStream(hooks, jobId) {
1753
1738
  fail
1754
1739
  };
1755
1740
  }
1756
- //#endregion
1757
- //#region src/publicFetch.ts
1741
+ // src/publicFetch.ts
1758
1742
  const MAX_REDIRECTS = 5;
1759
1743
  const MAX_BYTES = 52428800;
1760
1744
  const REDIRECTS = /* @__PURE__ */ new Set([
@@ -1853,8 +1837,7 @@ async function withPublicFetch(run) {
1853
1837
  globalThis.fetch = original;
1854
1838
  }
1855
1839
  }
1856
- //#endregion
1857
- //#region src/resolveConfig.ts
1840
+ // src/resolveConfig.ts
1858
1841
  /**
1859
1842
  * Turns the JSON config Studio sends back into live Kubb objects.
1860
1843
  *
@@ -2178,8 +2161,7 @@ async function mergeParsers({ diskParsers, studioParsers, extensions = /* @__PUR
2178
2161
  extensions
2179
2162
  })));
2180
2163
  }
2181
- //#endregion
2182
- //#region src/url.ts
2164
+ // src/url.ts
2183
2165
  /**
2184
2166
  * Hosted Kubb Studio URL, used when a host passes none.
2185
2167
  */
@@ -2206,8 +2188,7 @@ function secureUrl({ studioUrl, path, socket = false }) {
2206
2188
  if (socket) url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
2207
2189
  return url;
2208
2190
  }
2209
- //#endregion
2210
- //#region src/connect.ts
2191
+ // src/connect.ts
2211
2192
  const HEARTBEAT_INTERVAL_MS = 3e4;
2212
2193
  const MAX_HEARTBEAT_INTERVAL_MS = 6e4;
2213
2194
  const PING_TIMEOUT_MS = 1e4;
@@ -3187,8 +3168,7 @@ function connectAgent(options) {
3187
3168
  openRpc: openWebSocketRpc
3188
3169
  });
3189
3170
  }
3190
- //#endregion
3191
- //#region src/pair.ts
3171
+ // src/pair.ts
3192
3172
  /** Labels, not secrets: a person approving the code in the browser is what authorizes a pairing. */
3193
3173
  const CLIENT_IDS = {
3194
3174
  cli: "kubb-cli",
@@ -3337,8 +3317,7 @@ async function pairAgent({ onCode, onRetry, maxAttempts = 1, ...options }) {
3337
3317
  }
3338
3318
  }
3339
3319
  }
3340
- //#endregion
3341
- //#region src/snapshot.ts
3320
+ // src/snapshot.ts
3342
3321
  const UPLOAD_TIMEOUT_MS = 12e4;
3343
3322
  const BUNDLED_DEPENDENCIES = ["@kubb/plugin-barrel"];
3344
3323
  /**
@@ -3586,7 +3565,6 @@ async function createSnapshot({ studioUrl = defaultStudioUrl, apiKey, config, ho
3586
3565
  });
3587
3566
  return _data.snapshot;
3588
3567
  }
3589
- //#endregion
3590
3568
  export { IncompatibleAgentError, InvalidAgentTokenError, PairingCanceledError, PairingDeniedError, PairingExpiredError, connectAgent, createSnapshot, defaultStudioUrl, editConfig, editConfigFile, pairAgent };
3591
3569
 
3592
3570
  //# sourceMappingURL=index.js.map