@kubb/core 5.13.1 → 5.14.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/{Hookable-CNMSwKgf.js → Hookable-CvvyqvN3.js} +38 -5
- package/dist/Hookable-CvvyqvN3.js.map +1 -0
- package/dist/{createAdapter-BNUEQcw9.d.ts → createAdapter-CpL5uM0P.d.ts} +17 -2
- package/dist/index.cjs +37 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-CNMSwKgf.js.map +0 -1
|
@@ -19,7 +19,7 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
19
19
|
});
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region package.json
|
|
22
|
-
var version = "5.
|
|
22
|
+
var version = "5.14.0";
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region ../../internals/utils/src/casing.ts
|
|
25
25
|
/**
|
|
@@ -543,6 +543,12 @@ const diagnosticCatalog = {
|
|
|
543
543
|
cause: "Two generated modules export the same name, so the barrel cannot re-export both.",
|
|
544
544
|
fix: "Rename one of the colliding declarations, or configure the plugin resolver to produce distinct names."
|
|
545
545
|
},
|
|
546
|
+
inlineFailed: {
|
|
547
|
+
code: "KUBB_INLINE_FAILED",
|
|
548
|
+
title: "Inline definition failed",
|
|
549
|
+
cause: "A file imports a name from a file whose sources are all inline, and that name could not be inlined.",
|
|
550
|
+
fix: "Give every name the file imports an inline definition, register a parser with inline support for its extension, or stop marking the source as inline."
|
|
551
|
+
},
|
|
546
552
|
internalError: {
|
|
547
553
|
code: "KUBB_INTERNAL_ERROR",
|
|
548
554
|
title: "Internal error",
|
|
@@ -1743,7 +1749,7 @@ var Resolver = class Resolver {
|
|
|
1743
1749
|
return null;
|
|
1744
1750
|
}
|
|
1745
1751
|
static #computeOptions(node, { options, exclude = [], include, override = [] }) {
|
|
1746
|
-
if (node.kind ===
|
|
1752
|
+
if (node.kind === ast.nodeKinds.operation) {
|
|
1747
1753
|
if (exclude.some((filter) => Resolver.#matchesOperation(node, filter))) return null;
|
|
1748
1754
|
if (include && !include.some((filter) => Resolver.#matchesOperation(node, filter))) return null;
|
|
1749
1755
|
return {
|
|
@@ -1751,7 +1757,7 @@ var Resolver = class Resolver {
|
|
|
1751
1757
|
...override.find((filter) => Resolver.#matchesOperation(node, filter))?.options
|
|
1752
1758
|
};
|
|
1753
1759
|
}
|
|
1754
|
-
if (node.kind ===
|
|
1760
|
+
if (node.kind === ast.nodeKinds.schema) {
|
|
1755
1761
|
if (exclude.some((filter) => Resolver.#matchesSchema(node, filter) === true)) return null;
|
|
1756
1762
|
if (include) {
|
|
1757
1763
|
const applicable = include.map((filter) => Resolver.#matchesSchema(node, filter)).filter((result) => result !== null);
|
|
@@ -2221,6 +2227,16 @@ var FileManager = class {
|
|
|
2221
2227
|
return resolved;
|
|
2222
2228
|
}
|
|
2223
2229
|
/**
|
|
2230
|
+
* Removes the files at `paths`, so they are neither listed nor written.
|
|
2231
|
+
*/
|
|
2232
|
+
delete(...paths) {
|
|
2233
|
+
for (const path of paths) {
|
|
2234
|
+
this.#cache.delete(path);
|
|
2235
|
+
this.#pending.delete(path);
|
|
2236
|
+
}
|
|
2237
|
+
if (paths.length > 0) this.#sorted = null;
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2224
2240
|
* Releases all stored files. Called by the core after `kubb:build:end`.
|
|
2225
2241
|
*/
|
|
2226
2242
|
dispose() {
|
|
@@ -2381,7 +2397,7 @@ function assertPluginEntry(entry, index) {
|
|
|
2381
2397
|
* pointer into the input.
|
|
2382
2398
|
*/
|
|
2383
2399
|
function getCrashSite(node) {
|
|
2384
|
-
if (node.kind ===
|
|
2400
|
+
if (node.kind === ast.nodeKinds.schema) return {
|
|
2385
2401
|
label: node.name ? `schema "${node.name}"` : "an inline schema",
|
|
2386
2402
|
location: node.pointer ? {
|
|
2387
2403
|
kind: "schema",
|
|
@@ -2671,6 +2687,7 @@ var KubbDriver = class {
|
|
|
2671
2687
|
});
|
|
2672
2688
|
}
|
|
2673
2689
|
diagnostics.push(...await this.#runGenerators(generatorPlugins));
|
|
2690
|
+
this.#inlineFiles(parsersMap);
|
|
2674
2691
|
await hooks.callHook("kubb:plugins:end", this.#withFiles({ config }));
|
|
2675
2692
|
if (this.options.cleanPath) await config.storage.empty(this.options.cleanPath);
|
|
2676
2693
|
await fileManager.write(fileManager.files, {
|
|
@@ -2696,6 +2713,22 @@ var KubbDriver = class {
|
|
|
2696
2713
|
});
|
|
2697
2714
|
}
|
|
2698
2715
|
/**
|
|
2716
|
+
* Moves inline sources into the files that import them and drops the virtual files, before barrels
|
|
2717
|
+
* (`kubb:plugins:end`) and the write see them.
|
|
2718
|
+
*/
|
|
2719
|
+
#inlineFiles(parsers) {
|
|
2720
|
+
const { files, virtualPaths, problems } = ast.inlineFiles(this.fileManager.files, { language: (file) => parsers.get(file.extname)?.inline });
|
|
2721
|
+
if (virtualPaths.length === 0) return;
|
|
2722
|
+
this.fileManager.add(...files);
|
|
2723
|
+
this.fileManager.delete(...virtualPaths);
|
|
2724
|
+
if (problems.length > 0) Diagnostics.report({
|
|
2725
|
+
code: Diagnostics.code.inlineFailed,
|
|
2726
|
+
severity: "error",
|
|
2727
|
+
message: problems.map(({ path, message }) => `${path}: ${message}`).join("\n"),
|
|
2728
|
+
help: "Give every name the file imports an inline definition, register a parser with inline support for its extension, or stop marking the source as inline."
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
/**
|
|
2699
2732
|
* Widens `extra` with the files present at emit time and a bound `upsertFile`, the shape every
|
|
2700
2733
|
* file-carrying hook context shares. Building it here in one place keeps the `files` and
|
|
2701
2734
|
* `upsertFile` keys from being dropped by a stray spread at the call site.
|
|
@@ -3150,4 +3183,4 @@ var Hookable = class {
|
|
|
3150
3183
|
//#endregion
|
|
3151
3184
|
export { formatMs as A, writeRaw as B, useConfig as C, defineExtension as D, checkCompatibility as E, isPathInside as F, camelCase as H, listFiles as I, read as L, inParallel as M, exists as N, resolveMeta as O, existsSync$1 as P, rm$1 as R, tryUseKubb as S, useOptions as T, __name as U, toError as V, kubbContext as _, FileManager as a, setOptions as b, Resolver as c, isPublicAddress as d, assertPluginOption as f, injectFile as g, addMacro as h, createNodeCache as i, getElapsedMs as j, Diagnostics as k, getInputKind as l, addGenerator as m, KubbDriver as n, _usingCtx as o, definePlugin as p, pluginNotFoundError as r, createResolver as s, Hookable as t, checkoutGitInput as u, requirePlugin as v, useKubb as w, setResolver as x, setMacros as y, write as z };
|
|
3152
3185
|
|
|
3153
|
-
//# sourceMappingURL=Hookable-
|
|
3186
|
+
//# sourceMappingURL=Hookable-CvvyqvN3.js.map
|