@kubb/studio 5.12.7 → 5.13.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.js CHANGED
@@ -213,7 +213,7 @@ function getElapsedMs(hrStart) {
213
213
  }
214
214
  //#endregion
215
215
  //#region package.json
216
- var version = "5.12.7";
216
+ var version = "5.13.0";
217
217
  //#endregion
218
218
  //#region src/resolveConfig.ts
219
219
  /**
@@ -3241,6 +3241,22 @@ function header(path, size) {
3241
3241
  return value;
3242
3242
  }
3243
3243
  /**
3244
+ * Loads `tsdown` on first use. It is an optional peer dependency: it is large, and only snapshots need it.
3245
+ */
3246
+ async function loadTsdown(load = () => import("tsdown")) {
3247
+ try {
3248
+ return await load();
3249
+ } catch (error) {
3250
+ if (error.code !== "ERR_MODULE_NOT_FOUND" || !error.message.includes("'tsdown'")) throw error;
3251
+ throw new Diagnostics.Error({
3252
+ code: Diagnostics.code.missingDependency,
3253
+ severity: "error",
3254
+ message: "Missing dependency: tsdown. A snapshot builds its dist files with tsdown, which Kubb does not install by default.",
3255
+ help: "Run `npm i -D tsdown` in the project, then try again."
3256
+ });
3257
+ }
3258
+ }
3259
+ /**
3244
3260
  * Packs a generation's files into a gzipped, npm-installable tarball: a `package/` root with the
3245
3261
  * generated sources, a `tsdown`-built `dist/` (esm + cjs), and a `package.json` manifest.
3246
3262
  */
@@ -3269,7 +3285,7 @@ async function createSnapshotPackage({ files, packageInfo }) {
3269
3285
  }));
3270
3286
  const entry = [...sources.keys()].filter((path) => /\.(?:[cm]?[jt]sx?)$/.test(path)).map((path) => join(root, path));
3271
3287
  if (entry.length) {
3272
- const { build } = await import("tsdown");
3288
+ const { build } = await loadTsdown();
3273
3289
  await build({
3274
3290
  entry,
3275
3291
  outDir: dist,