@kubb/core 5.0.0-alpha.21 → 5.0.0-alpha.22

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.
@@ -1,7 +1,7 @@
1
1
  /** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */
2
2
  import { join } from 'node:path'
3
3
  import { getRelativePath } from '@internals/utils'
4
- import type { KubbFile } from '@kubb/fabric-core/types'
4
+ import type { FabricFile } from '@kubb/fabric-core/types'
5
5
  import type { BarrelType } from '../types.ts'
6
6
  import { TreeNode } from './TreeNode.ts'
7
7
 
@@ -29,16 +29,16 @@ type AddIndexesProps = {
29
29
  meta?: FileMetaBase
30
30
  }
31
31
 
32
- function getBarrelFilesByRoot(root: string | undefined, files: Array<KubbFile.ResolvedFile>): Array<KubbFile.File> {
33
- const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()
32
+ function getBarrelFilesByRoot(root: string | undefined, files: Array<FabricFile.ResolvedFile>): Array<FabricFile.File> {
33
+ const cachedFiles = new Map<FabricFile.Path, FabricFile.File>()
34
34
 
35
35
  TreeNode.build(files, root)?.forEach((treeNode) => {
36
36
  if (!treeNode?.children || !treeNode.parent?.data.path) {
37
37
  return
38
38
  }
39
39
 
40
- const barrelFilePath = join(treeNode.parent?.data.path, 'index.ts') as KubbFile.Path
41
- const barrelFile: KubbFile.File = {
40
+ const barrelFilePath = join(treeNode.parent?.data.path, 'index.ts') as FabricFile.Path
41
+ const barrelFile: FabricFile.File = {
42
42
  path: barrelFilePath,
43
43
  baseName: 'index.ts',
44
44
  exports: [],
@@ -113,7 +113,10 @@ function trimExtName(text: string): string {
113
113
  * - When `type` is `'all'`, strips named exports so every re-export becomes a wildcard (`export * from`).
114
114
  * - Attaches `meta` to each barrel file for downstream plugin identification.
115
115
  */
116
- export async function getBarrelFiles(files: Array<KubbFile.ResolvedFile>, { type, meta = {}, root, output }: AddIndexesProps): Promise<Array<KubbFile.File>> {
116
+ export async function getBarrelFiles(
117
+ files: Array<FabricFile.ResolvedFile>,
118
+ { type, meta = {}, root, output }: AddIndexesProps,
119
+ ): Promise<Array<FabricFile.File>> {
117
120
  if (!type || type === 'propagate') {
118
121
  return []
119
122
  }
@@ -1,7 +1,15 @@
1
1
  import type { Resolver } from '../types.ts'
2
2
 
3
3
  /**
4
- * Merges an array of resolvers into a single resolver. Later entries override earlier ones (last wins).
4
+ * Merges an ordered list of resolvers into a single resolver by shallow-merging each entry left to right.
5
+ *
6
+ * Later entries win when keys conflict, so the last resolver in the list takes highest precedence.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const resolver = mergeResolvers(resolverTs, resolverTsLegacy)
11
+ * // resolverTsLegacy methods override resolverTs where they overlap
12
+ * ```
5
13
  */
6
14
  export function mergeResolvers<T extends Resolver>(...resolvers: Array<T>): T {
7
15
  return resolvers.reduce<T>((acc, curr) => ({ ...acc, ...curr }), resolvers[0]!)