@kubb/ast 5.0.0-beta.89 → 5.0.0-beta.91

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 { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
2
- import { $ as importDef, $t as DistributiveOmit, A as ResponseNode, At as ArrowFunctionNode, B as createParameter, Bt as breakDef, C as inputDef, Ct as schemaDef, D as OperationNode, Dt as propertyDef, E as HttpOperationNode, Et as createProperty, F as createRequestBody, Ft as JSDocNode, G as SourceNode, Gt as createFunction, H as ExportNode, Ht as createArrowFunction, I as requestBodyDef, It as JsxNode, J as createFile, Jt as createType, K as UserFileNode, Kt as createJsx, L as ParameterLocation, Lt as TextNode, M as createResponse, Mt as CodeNode, N as responseDef, Nt as ConstNode, O as createOperation, Ot as InferSchemaNode, P as RequestBodyNode, Pt as FunctionNode, Q as fileDef, Qt as typeDef, R as ParameterNode, Rt as TypeNode, S as createInput, St as createSchema, T as HttpMethod, Tt as UserPropertyNode, U as FileNode, Ut as createBreak, V as parameterDef, Vt as constDef, W as ImportNode, Wt as createConst, X as createSource, Xt as jsxDef, Y as createImport, Yt as functionDef, Z as exportDef, Zt as textDef, _ as OutputNode, _t as SchemaType, a as Enforce, an as SchemaDialect, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, c as composeMacros, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, en as NodeDef, et as sourceDef, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, h as walk, ht as SchemaNode, i as createPrinter, in as Dialect, it as ArraySchemaNode, j as StatusCode, jt as BreakNode, k as operationDef, kt as ParserOptions, l as defineMacro, lt as NumberSchemaNode, m as transform, mt as ScalarSchemaType, n as PrinterFactoryOptions, nn as BaseNode, nt as contentDef, o as Macro, on as defineDialect, ot as DatetimeSchemaNode, p as collect, pt as ScalarSchemaNode, q as createExport, qt as createText, r as PrinterPartial, rn as NodeKind, rt as createContent, s as applyMacros, sn as schemaTypes, st as EnumSchemaNode, t as Printer, tn as defineNode, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, v as createOutput, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, y as outputDef, yt as TimeSchemaNode, z as ParameterStyle, zt as arrowFunctionDef } from "./types-BvAfoVB3.js";
2
+ import { $ as sourceDef, $t as NodeDef, A as StatusCode, At as BreakNode, B as parameterDef, Bt as constDef, C as GenericOperationNode, Ct as PropertyNode, D as createOperation, Dt as InferSchemaNode, E as OperationNode, Et as propertyDef, F as requestBodyDef, Ft as JsxNode, G as UserFileNode, Gt as createJsx, H as FileNode, Ht as createBreak, I as ParameterLocation, It as TextNode, J as createImport, Jt as functionDef, K as createExport, Kt as createText, L as ParameterNode, Lt as TypeNode, M as responseDef, Mt as ConstNode, N as RequestBodyNode, Nt as FunctionNode, O as operationDef, Ot as ParserOptions, P as createRequestBody, Pt as JSDocNode, Q as importDef, Qt as DistributiveOmit, R as ParameterStyle, Rt as arrowFunctionDef, S as inputDef, St as schemaDef, T as HttpOperationNode, Tt as createProperty, U as ImportNode, Ut as createConst, V as ExportNode, Vt as createArrowFunction, W as SourceNode, Wt as createFunction, X as exportDef, Xt as textDef, Y as createSource, Yt as jsxDef, Z as fileDef, Zt as typeDef, _ as createOutput, _t as StringSchemaNode, a as Enforce, an as defineDialect, at as DatetimeSchemaNode, b as InputNode, bt as UrlSchemaNode, c as composeMacros, ct as NumberSchemaNode, d as Visitor, dt as RefSchemaNode, en as defineNode, et as ContentNode, f as VisitorContext, ft as ScalarSchemaNode, g as OutputNode, gt as SchemaType, h as Node, ht as SchemaNodeByType, i as createPrinter, in as SchemaDialect, it as DateSchemaNode, j as createResponse, jt as CodeNode, k as ResponseNode, kt as ArrowFunctionNode, l as defineMacro, lt as ObjectSchemaNode, m as transform, mt as SchemaNode, n as PrinterFactoryOptions, nn as NodeKind, nt as createContent, o as Macro, on as schemaTypes, ot as EnumSchemaNode, p as collect, pt as ScalarSchemaType, q as createFile, qt as createType, r as PrinterPartial, rn as Dialect, rt as ArraySchemaNode, s as applyMacros, st as IntersectionSchemaNode, t as Printer, tn as BaseNode, tt as contentDef, u as ParentOf, ut as PrimitiveSchemaType, v as outputDef, vt as TimeSchemaNode, w as HttpMethod, wt as UserPropertyNode, x as createInput, xt as createSchema, y as InputMeta, yt as UnionSchemaNode, z as createParameter, zt as breakDef } from "./types-D12-e8Av.js";
3
3
 
4
4
  //#region src/guards.d.ts
5
5
  /**
@@ -382,8 +382,8 @@ declare const nodeDefs: (NodeDef<InputNode, Partial<Omit<InputNode, "kind">>> |
382
382
  type: "ipv6";
383
383
  }) | ScalarSchemaNode, "kind">> | NodeDef<PropertyNode, UserPropertyNode> | NodeDef<ParameterNode, Pick<ParameterNode, "schema" | "name" | "in"> & Partial<Omit<ParameterNode, "schema" | "kind" | "name" | "in">>> | NodeDef<ConstNode, Omit<ConstNode, "kind">> | NodeDef<TypeNode, Omit<TypeNode, "kind">> | NodeDef<FunctionNode, Omit<FunctionNode, "kind">> | NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">> | NodeDef<TextNode, string> | NodeDef<BreakNode, void> | NodeDef<JsxNode, string> | NodeDef<ImportNode, Omit<ImportNode, "kind">> | NodeDef<ExportNode, Omit<ExportNode, "kind">> | NodeDef<SourceNode, Omit<SourceNode, "kind">> | NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>)[];
384
384
  declare namespace exports_d_exports {
385
- export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, Dialect, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef, walk };
385
+ export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, Dialect, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef };
386
386
  }
387
387
  //#endregion
388
- export { type ArraySchemaNode, type ArrowFunctionNode, type BreakNode, type CodeNode, type ConstNode, type ContentNode, type DateSchemaNode, type DatetimeSchemaNode, type Dialect, type DistributiveOmit, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InferSchemaNode, type InputMeta, type InputNode, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeDef, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OutputNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PrinterPartial, type PropertyNode, type RefSchemaNode, type RequestBodyNode, type ResponseNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaDialect, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type UserFileNode, type Visitor, type VisitorContext, applyMacros, arrowFunctionDef, exports_d_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef, walk };
388
+ export { type ArraySchemaNode, type ArrowFunctionNode, type BreakNode, type CodeNode, type ConstNode, type ContentNode, type DateSchemaNode, type DatetimeSchemaNode, type Dialect, type DistributiveOmit, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InferSchemaNode, type InputMeta, type InputNode, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeDef, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OutputNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PrinterPartial, type PropertyNode, type RefSchemaNode, type RequestBodyNode, type ResponseNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaDialect, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type UserFileNode, type Visitor, type VisitorContext, applyMacros, arrowFunctionDef, exports_d_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef };
389
389
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1053,41 +1053,6 @@ const VISITOR_KEYS = Object.fromEntries(nodeDefs.flatMap((def) => def.children ?
1053
1053
  * definition's `visitorKey`.
1054
1054
  */
1055
1055
  const VISITOR_KEY_BY_KIND = Object.fromEntries(nodeDefs.flatMap((def) => def.visitorKey ? [[def.kind, def.visitorKey]] : []));
1056
- /**
1057
- * Creates a small async concurrency limiter.
1058
- *
1059
- * At most `concurrency` tasks are in flight at once. Extra tasks are queued.
1060
- *
1061
- * @example
1062
- * ```ts
1063
- * const limit = createLimit(2)
1064
- * for (const task of [taskA, taskB, taskC]) {
1065
- * await limit(() => task())
1066
- * }
1067
- * // only 2 tasks run at the same time
1068
- * ```
1069
- */
1070
- function createLimit(concurrency) {
1071
- let active = 0;
1072
- const queue = [];
1073
- function next() {
1074
- if (active < concurrency && queue.length > 0) {
1075
- active++;
1076
- queue.shift()();
1077
- }
1078
- }
1079
- return function limit(fn) {
1080
- return new Promise((resolve, reject) => {
1081
- queue.push(() => {
1082
- Promise.resolve(fn()).then(resolve, reject).finally(() => {
1083
- active--;
1084
- next();
1085
- });
1086
- });
1087
- next();
1088
- });
1089
- };
1090
- }
1091
1056
  const visitorKeysByKind = VISITOR_KEYS;
1092
1057
  /**
1093
1058
  * Returns `true` when `value` is an AST node (an object carrying a `kind`).
@@ -1123,9 +1088,9 @@ function* getChildren(node, recurse) {
1123
1088
  * context. The result is a replacement node, a collected value, or `undefined`
1124
1089
  * when no callback is registered for the kind.
1125
1090
  *
1126
- * Shared by `walk`, `transform`, and `collectLazy` so node-kind dispatch lives
1127
- * in one place. `TResult` is the caller's expected return: the same node type
1128
- * for `transform`, the collected value type for `collectLazy`, ignored for `walk`.
1091
+ * Shared by `transform` and `collectLazy` so node-kind dispatch lives in one place.
1092
+ * `TResult` is the caller's expected return: the same node type for `transform`,
1093
+ * the collected value type for `collectLazy`.
1129
1094
  */
1130
1095
  function applyVisitor(node, visitor, parent) {
1131
1096
  const key = VISITOR_KEY_BY_KIND[node.kind];
@@ -1133,37 +1098,6 @@ function applyVisitor(node, visitor, parent) {
1133
1098
  const fn = visitor[key];
1134
1099
  return fn?.(node, { parent });
1135
1100
  }
1136
- /**
1137
- * Async depth-first traversal for side effects. Visitor return values are
1138
- * ignored. Use `transform` when you want to rewrite nodes.
1139
- *
1140
- * Sibling nodes at each depth run concurrently up to `options.concurrency`
1141
- * (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
1142
- * work. Lower values reduce memory pressure.
1143
- *
1144
- * @example Log every operation
1145
- * ```ts
1146
- * await walk(root, {
1147
- * operation(node) {
1148
- * console.log(node.operationId)
1149
- * },
1150
- * })
1151
- * ```
1152
- *
1153
- * @example Only visit the root node
1154
- * ```ts
1155
- * await walk(root, { depth: 'shallow', input: () => {} })
1156
- * ```
1157
- */
1158
- async function walk(node, options) {
1159
- return _walk(node, options, (options.depth ?? visitorDepths.deep) === visitorDepths.deep, createLimit(options.concurrency ?? 30), void 0);
1160
- }
1161
- async function _walk(node, visitor, recurse, limit, parent) {
1162
- await limit(() => applyVisitor(node, visitor, parent));
1163
- let pending;
1164
- for (const child of getChildren(node, recurse)) (pending ??= []).push(_walk(child, visitor, recurse, limit, node));
1165
- if (pending) await Promise.all(pending);
1166
- }
1167
1101
  function transform(node, options) {
1168
1102
  const { depth, parent, ...visitor } = options;
1169
1103
  return transformNode(node, visitor, (depth ?? visitorDepths.deep) === visitorDepths.deep, parent);
@@ -1946,10 +1880,9 @@ var exports_exports = /* @__PURE__ */ __exportAll({
1946
1880
  syncSchemaRef: () => syncSchemaRef,
1947
1881
  textDef: () => textDef,
1948
1882
  transform: () => transform,
1949
- typeDef: () => typeDef,
1950
- walk: () => walk
1883
+ typeDef: () => typeDef
1951
1884
  });
1952
1885
  //#endregion
1953
- export { applyMacros, arrowFunctionDef, exports_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef, walk };
1886
+ export { applyMacros, arrowFunctionDef, exports_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineDialect, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef };
1954
1887
 
1955
1888
  //# sourceMappingURL=index.js.map