@kubb/plugin-barrel 5.0.0-beta.52 → 5.0.0-beta.54

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 (2) hide show
  1. package/package.json +4 -5
  2. package/extension.yaml +0 -197
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-barrel",
3
- "version": "5.0.0-beta.52",
3
+ "version": "5.0.0-beta.54",
4
4
  "description": "Barrel-file plugin for Kubb. Automatically generates index.ts re-export files per plugin output directory and an optional root barrel after all plugins complete.",
5
5
  "keywords": [
6
6
  "barrel",
@@ -19,7 +19,6 @@
19
19
  "files": [
20
20
  "src",
21
21
  "dist",
22
- "extension.yaml",
23
22
  "*.d.ts",
24
23
  "*.d.cts",
25
24
  "!/**/**.test.**",
@@ -43,14 +42,14 @@
43
42
  "registry": "https://registry.npmjs.org/"
44
43
  },
45
44
  "dependencies": {
46
- "@kubb/ast": "5.0.0-beta.52",
47
- "@kubb/core": "5.0.0-beta.52"
45
+ "@kubb/ast": "5.0.0-beta.54",
46
+ "@kubb/core": "5.0.0-beta.54"
48
47
  },
49
48
  "devDependencies": {
50
49
  "@internals/utils": "0.0.0"
51
50
  },
52
51
  "peerDependencies": {
53
- "@kubb/core": "5.0.0-beta.52"
52
+ "@kubb/core": "5.0.0-beta.54"
54
53
  },
55
54
  "engines": {
56
55
  "node": ">=22"
package/extension.yaml DELETED
@@ -1,197 +0,0 @@
1
- $schema: https://kubb.dev/schemas/extension.json
2
- kind: plugin
3
- id: plugin-barrel
4
- name: Barrel
5
- description: Generates `index.ts` re-export files for every plugin output and one root barrel. Ships with Kubb and is enabled by default.
6
- category: output
7
- type: official
8
- npmPackage: '@kubb/plugin-barrel'
9
- docsPath: /plugins/plugin-barrel
10
- repo: https://github.com/kubb-labs/kubb
11
- maintainers:
12
- - name: Stijn Van Hulle
13
- github: stijnvanhulle
14
- compatibility:
15
- kubb: '>=5.0.0'
16
- node: '>=22'
17
- tags:
18
- - barrel
19
- - index
20
- - exports
21
- - output
22
- resources:
23
- documentation: https://kubb.dev/plugins/plugin-barrel
24
- repository: https://github.com/kubb-labs/kubb
25
- issues: https://github.com/kubb-labs/kubb/issues
26
- changelog: https://github.com/kubb-labs/kubb/blob/main/packages/plugin-barrel/CHANGELOG.md
27
- featured: true
28
- intro: |-
29
- `@kubb/plugin-barrel` generates an `index.ts` for every plugin output directory and one root barrel at `output.path/index.ts` after the build completes. The result is a single import surface for every consumer — `import { Pet, usePetByIdQuery, petMock } from './gen'`.
30
-
31
- The plugin ships with Kubb and is registered by default in `defineConfig`, so barrels appear out of the box with no extra configuration. When `pluginBarrel` is part of `config.plugins`, `defineConfig` also applies a default `output.barrel` of `{ type: 'named' }`.
32
-
33
- Plugins inherit `output.barrel` from `config.output.barrel` when their own value is omitted. Setting `barrel: false` on a plugin disables that plugin's barrel **and** excludes its files from the root barrel.
34
- options:
35
- - name: barrel
36
- type: "{ type: 'all' | 'named', nested?: boolean } | false"
37
- required: false
38
- default: "{ type: 'named' }"
39
- description: |-
40
- Re-export style used for every generated barrel file. Set via `output.barrel` in `defineConfig` (applies to all plugins and the root barrel) or per plugin via that plugin's own `output.barrel`. It is not an argument to the plugin itself.
41
-
42
- At the config level:
43
-
44
- - `{ type: 'all' }` — `export * from '...'` for every generated file.
45
- - `{ type: 'named' }` — `export { Foo, Bar } from '...'` using each file's named exports.
46
- - `false` — disables barrel generation entirely.
47
-
48
- At the plugin level you also get `nested`:
49
-
50
- - `{ type: 'named', nested: true }` — generates a barrel for every subdirectory, re-exporting only direct children. Lets callers import from any depth.
51
- - `false` — disables the plugin's barrel and removes its files from the root barrel.
52
-
53
- The `{ type: 'named' }` default kicks in only when `pluginBarrel` is part of `config.plugins`.
54
- codeBlock:
55
- lang: typescript
56
- title: kubb.config.ts
57
- twoslash: false
58
- code: |-
59
- import { defineConfig } from 'kubb'
60
- import { pluginBarrel } from '@kubb/plugin-barrel'
61
-
62
- export default defineConfig({
63
- input: { path: './petStore.yaml' },
64
- output: { path: './src/gen', barrel: { type: 'named' } },
65
- plugins: [pluginBarrel()],
66
- })
67
- examples:
68
- - name: "{ type: 'named' } (default)"
69
- files:
70
- - name: kubb.config.ts
71
- lang: typescript
72
- twoslash: false
73
- code: |-
74
- import { defineConfig } from 'kubb'
75
-
76
- export default defineConfig({
77
- input: { path: './petStore.yaml' },
78
- output: { path: './src/gen' },
79
- plugins: [],
80
- })
81
- - name: Generated output
82
- lang: typescript
83
- twoslash: false
84
- code: |-
85
- // src/gen/index.ts
86
- export { getUser, User } from './api/user'
87
- export { getPost, Post } from './api/post'
88
- export { User } from './api/types/User'
89
- export { useUser } from './hooks/useUser'
90
-
91
- // src/gen/api/index.ts
92
- export { getUser, User } from './user'
93
- export { getPost, Post } from './post'
94
- export { User } from './types/User'
95
-
96
- // src/gen/api/types/index.ts
97
- export { User } from './User'
98
- - name: "{ type: 'all' }"
99
- files:
100
- - name: kubb.config.ts
101
- lang: typescript
102
- twoslash: false
103
- code: |-
104
- import { defineConfig } from 'kubb'
105
-
106
- export default defineConfig({
107
- input: { path: './petStore.yaml' },
108
- output: { path: './src/gen', barrel: { type: 'all' } },
109
- plugins: [],
110
- })
111
- - name: Generated output
112
- lang: typescript
113
- twoslash: false
114
- code: |-
115
- // src/gen/index.ts
116
- export * from './api/user'
117
- export * from './api/post'
118
- export * from './api/types/User'
119
- export * from './hooks/useUser'
120
-
121
- // src/gen/api/index.ts
122
- export * from './user'
123
- export * from './post'
124
- export * from './types/User'
125
-
126
- // src/gen/api/types/index.ts
127
- export * from './User'
128
- - name: "{ type: 'named', nested: true }"
129
- files:
130
- - name: kubb.config.ts
131
- lang: typescript
132
- twoslash: false
133
- code: |-
134
- import { defineConfig } from 'kubb'
135
-
136
- export default defineConfig({
137
- input: { path: './petStore.yaml' },
138
- output: { path: './src/gen', barrel: { type: 'named', nested: true } },
139
- plugins: [],
140
- })
141
- - name: Generated output (chained structure)
142
- lang: typescript
143
- twoslash: false
144
- code: |-
145
- // src/gen/index.ts (only exports directories)
146
- export * from './api'
147
- export * from './hooks'
148
-
149
- // src/gen/api/index.ts (exports files and subdirs)
150
- export * from './user'
151
- export * from './post'
152
- export * from './types'
153
-
154
- // src/gen/api/types/index.ts (exports files)
155
- export * from './User'
156
- - name: Disable the barrel for a single plugin
157
- files:
158
- - name: kubb.config.ts
159
- lang: typescript
160
- twoslash: false
161
- code: |-
162
- import { defineConfig } from 'kubb'
163
- import { pluginTs } from '@kubb/plugin-ts'
164
- import { pluginZod } from '@kubb/plugin-zod'
165
-
166
- // pluginZod opts out: no zod/index.ts is created,
167
- // and zod files are excluded from the root index.ts.
168
- export default defineConfig({
169
- input: { path: './petStore.yaml' },
170
- output: { path: './src/gen' },
171
- plugins: [
172
- pluginTs(),
173
- pluginZod({ output: { barrel: false } }),
174
- ],
175
- })
176
- - name: Disable only the root barrel
177
- files:
178
- - name: kubb.config.ts
179
- lang: typescript
180
- twoslash: false
181
- code: |-
182
- import { defineConfig } from 'kubb'
183
-
184
- # No root index.ts is generated, but each plugin
185
- # still gets its own barrel using its inherited config.
186
- export default defineConfig({
187
- input: { path: './petStore.yaml' },
188
- output: { path: './src/gen', barrel: false },
189
- plugins: [],
190
- })
191
- notes:
192
- - type: tip
193
- body: |-
194
- `plugin-barrel` ships with Kubb and is enabled automatically. Install it explicitly only when customizing barrel behavior.
195
- - type: note
196
- body: |-
197
- `output.barrel` is auto-defaulted to `{ type: 'named' }` only when `pluginBarrel` is part of `config.plugins`. Without it, set `output.barrel` yourself if you still want a barrel.