@kubb/core 5.0.0-beta.57 → 5.0.0-beta.58
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/{diagnostics-Bf2bC8lV.d.ts → diagnostics-BNcDERWL.d.ts} +5 -4
- package/dist/index.cjs +19 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/dist/{memoryStorage-skOz0dXZ.cjs → memoryStorage-Bz4ZDIZz.cjs} +6 -4
- package/dist/memoryStorage-Bz4ZDIZz.cjs.map +1 -0
- package/dist/{memoryStorage-B0W-w994.js → memoryStorage-DZYKdzI6.js} +4 -3
- package/dist/memoryStorage-DZYKdzI6.js.map +1 -0
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +4 -4
- package/src/FileManager.ts +2 -2
- package/src/FileProcessor.ts +1 -1
- package/src/KubbDriver.ts +10 -4
- package/src/createAdapter.ts +1 -1
- package/src/defineParser.ts +3 -2
- package/src/defineResolver.ts +3 -2
- package/src/index.ts +1 -0
- package/dist/memoryStorage-B0W-w994.js.map +0 -1
- package/dist/memoryStorage-skOz0dXZ.cjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-
|
|
2
|
+
import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-BNcDERWL.js";
|
|
3
3
|
import * as ast from "@kubb/ast";
|
|
4
4
|
|
|
5
5
|
//#region ../../internals/utils/src/url.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import "./chunk-C0LytTxp.js";
|
|
2
|
-
import { a as createStorage, c as camelCase, d as BuildError, f as getErrorMessage, i as FileManager, l as pascalCase, n as _usingCtx, o as OPERATION_FILTER_TYPES, r as FileProcessor, s as diagnosticCode, t as memoryStorage, u as AsyncEventEmitter } from "./memoryStorage-
|
|
2
|
+
import { a as createStorage, c as camelCase, d as BuildError, f as getErrorMessage, i as FileManager, l as pascalCase, n as _usingCtx, o as OPERATION_FILTER_TYPES, r as FileProcessor, s as diagnosticCode, t as memoryStorage, u as AsyncEventEmitter } from "./memoryStorage-DZYKdzI6.js";
|
|
3
3
|
import { hash } from "node:crypto";
|
|
4
4
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
5
5
|
import { access, glob, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
6
6
|
import path, { dirname, join, relative, resolve } from "node:path";
|
|
7
7
|
import * as ast from "@kubb/ast";
|
|
8
|
-
import {
|
|
8
|
+
import { operationDef, schemaDef, transform } from "@kubb/ast";
|
|
9
9
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
import * as factory from "@kubb/ast/factory";
|
|
11
|
+
import { collectUsedSchemaNames } from "@kubb/ast/utils";
|
|
10
12
|
import process$1 from "node:process";
|
|
11
13
|
//#region ../../internals/utils/src/time.ts
|
|
12
14
|
/**
|
|
@@ -590,7 +592,7 @@ var Url = class Url {
|
|
|
590
592
|
* document: null,
|
|
591
593
|
* async parse(_source) {
|
|
592
594
|
* // Convert `source` (path or inline data) into an InputNode.
|
|
593
|
-
* return ast.createInput()
|
|
595
|
+
* return ast.factory.createInput()
|
|
594
596
|
* },
|
|
595
597
|
* getImports: () => [],
|
|
596
598
|
* async validate() {
|
|
@@ -607,7 +609,7 @@ function createAdapter(build) {
|
|
|
607
609
|
/**
|
|
608
610
|
* Docs major, derived from the package version so the link tracks the published major.
|
|
609
611
|
*/
|
|
610
|
-
const docsMajor = "5.0.0-beta.
|
|
612
|
+
const docsMajor = "5.0.0-beta.58".split(".")[0] ?? "5";
|
|
611
613
|
/**
|
|
612
614
|
* Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
|
|
613
615
|
*
|
|
@@ -1309,7 +1311,7 @@ function defaultResolveFile({ name, extname, tag, path: groupPath }, context) {
|
|
|
1309
1311
|
tag,
|
|
1310
1312
|
path: groupPath
|
|
1311
1313
|
}, context);
|
|
1312
|
-
return createFile({
|
|
1314
|
+
return factory.createFile({
|
|
1313
1315
|
path: filePath,
|
|
1314
1316
|
baseName: path.basename(filePath),
|
|
1315
1317
|
meta: { pluginName: this.pluginName },
|
|
@@ -1647,7 +1649,7 @@ var KubbDriver = class {
|
|
|
1647
1649
|
/**
|
|
1648
1650
|
* Parses the adapter source into `this.inputNode`. Idempotent, so repeated calls from
|
|
1649
1651
|
* `run` do not re-parse. Adapters with `stream()` are used directly.
|
|
1650
|
-
* Adapters with only `parse()` are wrapped via `
|
|
1652
|
+
* Adapters with only `parse()` are wrapped via `factory.createInput({ stream: true })` so the dispatch loop
|
|
1651
1653
|
* stays stream-only.
|
|
1652
1654
|
*/
|
|
1653
1655
|
async #parseInput() {
|
|
@@ -1659,7 +1661,12 @@ var KubbDriver = class {
|
|
|
1659
1661
|
return;
|
|
1660
1662
|
}
|
|
1661
1663
|
const parsed = await adapter.parse(source);
|
|
1662
|
-
this.inputNode =
|
|
1664
|
+
this.inputNode = factory.createInput({
|
|
1665
|
+
stream: true,
|
|
1666
|
+
schemas: arrayToAsyncIterable(parsed.schemas),
|
|
1667
|
+
operations: arrayToAsyncIterable(parsed.operations),
|
|
1668
|
+
meta: parsed.meta
|
|
1669
|
+
});
|
|
1663
1670
|
}
|
|
1664
1671
|
/**
|
|
1665
1672
|
* Registers a hook-style plugin's lifecycle handlers on the shared `AsyncEventEmitter`.
|
|
@@ -1703,7 +1710,7 @@ var KubbDriver = class {
|
|
|
1703
1710
|
}
|
|
1704
1711
|
},
|
|
1705
1712
|
injectFile: (userFileNode) => {
|
|
1706
|
-
this.fileManager.add(createFile(userFileNode));
|
|
1713
|
+
this.fileManager.add(factory.createFile(userFileNode));
|
|
1707
1714
|
}
|
|
1708
1715
|
};
|
|
1709
1716
|
return hooks["kubb:plugin:setup"](pluginCtx);
|
|
@@ -2861,14 +2868,15 @@ function defineGenerator(generator) {
|
|
|
2861
2868
|
*
|
|
2862
2869
|
* @example
|
|
2863
2870
|
* ```ts
|
|
2864
|
-
* import { defineParser
|
|
2871
|
+
* import { defineParser } from '@kubb/core'
|
|
2872
|
+
* import { extractStringsFromNodes } from '@kubb/ast/utils'
|
|
2865
2873
|
*
|
|
2866
2874
|
* export const jsonParser = defineParser({
|
|
2867
2875
|
* name: 'json',
|
|
2868
2876
|
* extNames: ['.json'],
|
|
2869
2877
|
* parse(file) {
|
|
2870
2878
|
* return file.sources
|
|
2871
|
-
* .map((source) =>
|
|
2879
|
+
* .map((source) => extractStringsFromNodes(source.nodes ?? []))
|
|
2872
2880
|
* .join('\n')
|
|
2873
2881
|
* },
|
|
2874
2882
|
* print(...nodes) {
|