@kubb/ast 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.
Files changed (43) hide show
  1. package/README.md +11 -7
  2. package/dist/{types-C5aVnRE1.d.ts → ast-ClnJg9BN.d.ts} +82 -836
  3. package/dist/chunk-CNktS9qV.js +17 -0
  4. package/dist/extractStringsFromNodes-Bn9cOos9.d.ts +14 -0
  5. package/dist/factory-C5gHvtLU.js +138 -0
  6. package/dist/factory-C5gHvtLU.js.map +1 -0
  7. package/dist/factory-JN-Ylfl6.cjs +155 -0
  8. package/dist/factory-JN-Ylfl6.cjs.map +1 -0
  9. package/dist/factory.cjs +31 -0
  10. package/dist/factory.d.ts +62 -0
  11. package/dist/factory.js +3 -0
  12. package/dist/index.cjs +86 -1746
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +6 -3
  15. package/dist/index.js +177 -1809
  16. package/dist/index.js.map +1 -1
  17. package/dist/types-CB2oY8Dw.d.ts +769 -0
  18. package/dist/types.d.ts +4 -2
  19. package/dist/utils-C8bWAzhv.cjs +2696 -0
  20. package/dist/utils-C8bWAzhv.cjs.map +1 -0
  21. package/dist/utils-DN4XLVqz.js +2099 -0
  22. package/dist/utils-DN4XLVqz.js.map +1 -0
  23. package/dist/utils.cjs +12 -1
  24. package/dist/utils.d.ts +21 -2
  25. package/dist/utils.js +2 -2
  26. package/package.json +5 -1
  27. package/src/factory.ts +19 -1
  28. package/src/index.ts +14 -48
  29. package/src/node.ts +1 -1
  30. package/src/nodes/base.ts +0 -10
  31. package/src/nodes/function.ts +2 -2
  32. package/src/nodes/index.ts +1 -1
  33. package/src/nodes/input.ts +14 -13
  34. package/src/printer.ts +3 -3
  35. package/src/types.ts +1 -1
  36. package/src/utils/ast.ts +3 -66
  37. package/src/utils/extractStringsFromNodes.ts +34 -0
  38. package/src/utils/index.ts +44 -0
  39. package/dist/chunk-C0LytTxp.js +0 -8
  40. package/dist/utils-0p8ZO287.js +0 -570
  41. package/dist/utils-0p8ZO287.js.map +0 -1
  42. package/dist/utils-cdQ6Pzyi.cjs +0 -726
  43. package/dist/utils-cdQ6Pzyi.cjs.map +0 -1
package/README.md CHANGED
@@ -28,10 +28,12 @@ Defines the node tree, visitor pattern, factory functions, and type guards used
28
28
 
29
29
  ## Imports
30
30
 
31
- | Path | Contents |
32
- | ----------------- | ------------------------------------------------------------------- |
33
- | `@kubb/ast` | Runtime: factory functions, guards, visitor, ref helpers, constants |
34
- | `@kubb/ast/types` | Types only: all node interfaces, type aliases, visitor types |
31
+ | Path | Contents |
32
+ | ------------------- | ---------------------------------------------------------------------------------------- |
33
+ | `@kubb/ast` | Runtime: node definitions, guards, visitor, transformers, constants |
34
+ | `@kubb/ast/factory` | Node constructors (`createSchema`, `createFile`, and friends), the `ts.factory` analogue |
35
+ | `@kubb/ast/types` | Types only: all node interfaces, type aliases, visitor types |
36
+ | `@kubb/ast/utils` | Spec-agnostic string and identifier helpers, ref helpers |
35
37
 
36
38
  ## Node tree
37
39
 
@@ -56,10 +58,12 @@ SchemaNode (discriminated union)
56
58
 
57
59
  ### Factory
58
60
 
61
+ Constructors live on the `@kubb/ast/factory` subpath, mirroring `ts.factory.createX`. Through `@kubb/core` the same set is reachable as `ast.factory.createSchema(...)`.
62
+
59
63
  ```ts
60
- import { createRoot, createOperation, createSchema, createProperty } from '@kubb/ast'
64
+ import { createInput, createSchema, createProperty } from '@kubb/ast/factory'
61
65
 
62
- const root = createRoot({
66
+ const root = createInput({
63
67
  schemas: [
64
68
  createSchema({
65
69
  name: 'Pet',
@@ -125,7 +129,7 @@ function process(node: Node) {
125
129
  ### Refs
126
130
 
127
131
  ```ts
128
- import { extractRefName } from '@kubb/ast'
132
+ import { extractRefName } from '@kubb/ast/utils'
129
133
 
130
134
  extractRefName('#/components/schemas/Pet') // 'Pet'
131
135
  ```