@kubb/studio 5.21.2 → 5.23.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 +35 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -27
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import path, { dirname, isAbsolute, join, relative, resolve, sep } from "node:pa
|
|
|
8
8
|
import process$1 from "node:process";
|
|
9
9
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
10
10
|
import { x } from "tinyexec";
|
|
11
|
-
import { Diagnostics, Hookable, Kubb, cacheStorage, checkoutGitInput,
|
|
11
|
+
import { Diagnostics, Hookable, Kubb, cacheStorage, checkoutGitInput, fsStorage, getInputKind, isPackageName, isPublicAddress, readInstalledPackages, resolveCacheDir, resolveMeta } from "@kubb/core";
|
|
12
12
|
import { RpcTarget, newWebSocketRpcSession } from "capnweb";
|
|
13
13
|
import { pathToFileURL } from "node:url";
|
|
14
14
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -275,7 +275,7 @@ function isPathInside(path, parent) {
|
|
|
275
275
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
276
276
|
}
|
|
277
277
|
// package.json
|
|
278
|
-
var version = "5.
|
|
278
|
+
var version = "5.23.0";
|
|
279
279
|
// ../../internals/shared/src/constants.ts
|
|
280
280
|
/**
|
|
281
281
|
* Extensions `kubb` ships at its own version, so they count as installed without being a direct
|
|
@@ -1430,27 +1430,30 @@ function generationFailure(diagnostics) {
|
|
|
1430
1430
|
return /* @__PURE__ */ new Error(`Generation failed: ${reasons.length} error${reasons.length === 1 ? "" : "s"}: ${reasons.join("; ")}`);
|
|
1431
1431
|
}
|
|
1432
1432
|
/**
|
|
1433
|
-
*
|
|
1434
|
-
* `output.postGenerate` only run with `allowExec`. Throws when
|
|
1433
|
+
* Generates the config at `only` and returns the files it produced. It shares schemas with the other `configs` that set
|
|
1434
|
+
* the same `shared.path`. The formatter, the linter, and `output.postGenerate` only run with `allowExec`. Throws when
|
|
1435
|
+
* any plugin reports an error.
|
|
1435
1436
|
*/
|
|
1436
|
-
async function generate({
|
|
1437
|
+
async function generate({ configs, only = 0, hooks, signal, allowExec, fileRefs }) {
|
|
1438
|
+
const config = configs[only];
|
|
1437
1439
|
const output = allowExec ? config.output : {
|
|
1438
1440
|
...config.output,
|
|
1439
1441
|
format: false,
|
|
1440
1442
|
lint: false,
|
|
1441
1443
|
postGenerate: []
|
|
1442
1444
|
};
|
|
1443
|
-
const
|
|
1445
|
+
const result = (await Array.fromAsync(Kubb.generate(configs.with(only, {
|
|
1444
1446
|
...config,
|
|
1445
1447
|
output
|
|
1446
|
-
}, {
|
|
1448
|
+
}), {
|
|
1447
1449
|
hooks,
|
|
1448
1450
|
signal,
|
|
1449
|
-
fileRefs
|
|
1450
|
-
|
|
1451
|
-
|
|
1451
|
+
fileRefs,
|
|
1452
|
+
only
|
|
1453
|
+
})))[0];
|
|
1454
|
+
if (result.error) throw result.error;
|
|
1452
1455
|
if (!result.success) throw generationFailure(result.diagnostics);
|
|
1453
|
-
const { storage, root } = kubb.config;
|
|
1456
|
+
const { storage, root } = result.kubb.config;
|
|
1454
1457
|
return {
|
|
1455
1458
|
storage,
|
|
1456
1459
|
root,
|
|
@@ -2670,23 +2673,29 @@ var Agent = class extends RpcTarget {
|
|
|
2670
2673
|
message: getErrorMessage(error),
|
|
2671
2674
|
code: Diagnostics.code.gitInputFailed
|
|
2672
2675
|
})) : void 0;
|
|
2673
|
-
const
|
|
2674
|
-
config
|
|
2675
|
-
|
|
2676
|
+
const buildConfig = {
|
|
2677
|
+
...config,
|
|
2678
|
+
root,
|
|
2679
|
+
input: checkout?.path ?? studioInput ?? config.input,
|
|
2680
|
+
output: mergeOutput({
|
|
2681
|
+
output: config.output,
|
|
2682
|
+
studio: patch?.output
|
|
2683
|
+
}),
|
|
2684
|
+
storage: outputRoot ? stagingStorage({
|
|
2676
2685
|
root,
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2686
|
+
directory: outputRoot
|
|
2687
|
+
}) : fsStorage(),
|
|
2688
|
+
plugins: activePlugins,
|
|
2689
|
+
adapter,
|
|
2690
|
+
parsers
|
|
2691
|
+
};
|
|
2692
|
+
const buildConfigs = this.#sandbox || this.#managed ? [buildConfig] : configs.map((entry) => entry === config ? buildConfig : {
|
|
2693
|
+
...entry,
|
|
2694
|
+
root
|
|
2695
|
+
});
|
|
2696
|
+
const run = () => generate({
|
|
2697
|
+
configs: buildConfigs,
|
|
2698
|
+
only: buildConfigs.indexOf(buildConfig),
|
|
2690
2699
|
hooks: this.#options.hooks,
|
|
2691
2700
|
signal,
|
|
2692
2701
|
allowExec: this.#permissions.allowWrite && this.#permissions.allowExec,
|