@kubb/core 5.0.0-beta.56 → 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/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-Bf2bC8lV.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-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-B0W-w994.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-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 { collectUsedSchemaNames, createFile, createStreamInput, isOperationNode, isSchemaNode, transform } from "@kubb/ast";
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.56".split(".")[0] ?? "5";
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
  *
@@ -1168,7 +1170,7 @@ function defaultResolver(name, type) {
1168
1170
  */
1169
1171
  const resolveOptionsCache = /* @__PURE__ */ new WeakMap();
1170
1172
  function computeOptions(node, options, exclude, include, override) {
1171
- if (isOperationNode(node)) {
1173
+ if (operationDef.is(node)) {
1172
1174
  if (exclude.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
1173
1175
  if (include && !include.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
1174
1176
  const overrideOptions = override.find(({ type, pattern }) => matchesOperationPattern(node, type, pattern))?.options;
@@ -1177,7 +1179,7 @@ function computeOptions(node, options, exclude, include, override) {
1177
1179
  ...overrideOptions
1178
1180
  };
1179
1181
  }
1180
- if (isSchemaNode(node)) {
1182
+ if (schemaDef.is(node)) {
1181
1183
  if (exclude.some(({ type, pattern }) => matchesSchemaPattern(node, type, pattern) === true)) return null;
1182
1184
  if (include) {
1183
1185
  const applicable = include.map(({ type, pattern }) => matchesSchemaPattern(node, type, pattern)).filter((result) => result !== null);
@@ -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 `createStreamInput` so the dispatch loop
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 = createStreamInput(arrayToAsyncIterable(parsed.schemas), arrayToAsyncIterable(parsed.operations), parsed.meta);
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, ast } from '@kubb/core'
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) => ast.extractStringsFromNodes(source.nodes ?? []))
2879
+ * .map((source) => extractStringsFromNodes(source.nodes ?? []))
2872
2880
  * .join('\n')
2873
2881
  * },
2874
2882
  * print(...nodes) {