@kubb/plugin-barrel 5.10.2 → 5.10.3
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.cjs +1 -1
- package/dist/index.d.cts +112 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -2
- package/package.json +11 -6
- package/dist/rolldown-runtime-C0LytTxp.js +0 -8
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
//#region src/plugin.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Canonical plugin name for `@kubb/plugin-barrel`. Used for driver lookups
|
|
4
|
+
* and to guard the `kubb:plugin:end` handler against reacting to its own lifecycle hook.
|
|
5
|
+
*/
|
|
6
|
+
export declare const pluginBarrelName = "plugin-barrel";
|
|
7
|
+
/**
|
|
8
|
+
* Generates an `index.ts` for every plugin output directory and one root
|
|
9
|
+
* barrel at `config.output.path/index.ts` after the build completes. Ships
|
|
10
|
+
* with Kubb and is registered by default in `defineConfig`, but generates
|
|
11
|
+
* nothing until a barrel is configured.
|
|
12
|
+
*
|
|
13
|
+
* Each plugin inherits `output.barrel` from `config.output.barrel` (which
|
|
14
|
+
* defaults to `false`, no barrel). Set `barrel: { type: 'named' | 'all' }` on
|
|
15
|
+
* the root config, a plugin, or both to opt in; a plugin-level `false`
|
|
16
|
+
* overrides an enabled root barrel and also excludes that plugin's files
|
|
17
|
+
* from the root barrel.
|
|
18
|
+
*
|
|
19
|
+
* A plugin with `output.mode: 'file'` gets no per-plugin barrel, since its output
|
|
20
|
+
* is a single file. The root barrel re-exports that file directly.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { defineConfig } from '@kubb/core'
|
|
25
|
+
* import { pluginBarrel } from '@kubb/plugin-barrel'
|
|
26
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
27
|
+
* import { pluginZod } from '@kubb/plugin-zod'
|
|
28
|
+
*
|
|
29
|
+
* export default defineConfig({
|
|
30
|
+
* input: './petStore.yaml',
|
|
31
|
+
* output: { path: 'src/gen', barrel: { type: 'named' } },
|
|
32
|
+
* plugins: [
|
|
33
|
+
* pluginTs({ output: { path: 'types', barrel: { type: 'all' } } }),
|
|
34
|
+
* pluginZod({ output: { path: 'schemas' } }),
|
|
35
|
+
* pluginBarrel(),
|
|
36
|
+
* ],
|
|
37
|
+
* })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const pluginBarrel: import("@kubb/core").PluginFactory<import("@kubb/core").PluginType<string, object, object, import("@kubb/core").Resolver>>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/types.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* Barrel export strategy.
|
|
45
|
+
*
|
|
46
|
+
* - `'all'` generates `export * from '...'` for every file
|
|
47
|
+
* - `'named'` generates `export { name1, name2 } from '...'` using each file's named exports
|
|
48
|
+
*/
|
|
49
|
+
type BarrelType = 'all' | 'named';
|
|
50
|
+
/**
|
|
51
|
+
* Barrel configuration at the plugin level.
|
|
52
|
+
* Supports nested barrel generation in subdirectories.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* barrel: { type: 'named' } // single barrel with named exports
|
|
57
|
+
* barrel: { type: 'all', nested: true } // hierarchical barrels with wildcard exports
|
|
58
|
+
* barrel: { type: 'named', nested: true } // hierarchical barrels with named exports
|
|
59
|
+
* barrel: false // no barrel generated (default)
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
type PluginBarrelConfig = {
|
|
63
|
+
/**
|
|
64
|
+
* Export strategy for the plugin's barrel files.
|
|
65
|
+
* - `'all'` wildcard exports: `export * from './file'`
|
|
66
|
+
* - `'named'` explicit exports: `export { x, y } from './file'`
|
|
67
|
+
*/
|
|
68
|
+
type: BarrelType;
|
|
69
|
+
/**
|
|
70
|
+
* Generate an `index.ts` in every sub-directory, each re-exporting only what's directly inside it.
|
|
71
|
+
* Creates a hierarchical barrel structure instead of flat exports from the root.
|
|
72
|
+
*/
|
|
73
|
+
nested?: boolean;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Barrel configuration at the root config level: the export strategy only, since the root barrel is never nested.
|
|
77
|
+
*/
|
|
78
|
+
type BarrelConfig = Pick<PluginBarrelConfig, 'type'>;
|
|
79
|
+
declare global {
|
|
80
|
+
namespace Kubb {
|
|
81
|
+
interface PluginOptionsRegistry {
|
|
82
|
+
output: {
|
|
83
|
+
/**
|
|
84
|
+
* Barrel configuration for this plugin's output.
|
|
85
|
+
* Set to `{ type: 'named' | 'all' }` to opt this plugin into a barrel. Set to `false`
|
|
86
|
+
* (the default) to disable barrel generation for this plugin entirely, which also
|
|
87
|
+
* excludes the plugin's files from the root barrel.
|
|
88
|
+
*
|
|
89
|
+
* Falls back to `config.output.barrel` when omitted.
|
|
90
|
+
*
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
barrel?: PluginBarrelConfig | false;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface ConfigOptionsRegistry {
|
|
97
|
+
output: {
|
|
98
|
+
/**
|
|
99
|
+
* Barrel configuration for the root barrel file at `config.output.path/index.ts`.
|
|
100
|
+
* Set to `{ type: 'named' | 'all' }` to opt into a root barrel. Individual plugins can
|
|
101
|
+
* override this via their own `output.barrel`.
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
barrel?: BarrelConfig | false;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export type { BarrelConfig, BarrelType, PluginBarrelConfig };
|
|
112
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
1
|
import path, { extname, isAbsolute, posix, relative, resolve } from "node:path";
|
|
3
2
|
import { defineExtension } from "@kubb/core";
|
|
4
3
|
import { Diagnostics, ast } from "@kubb/kit";
|
|
4
|
+
//#endregion
|
|
5
5
|
//#region ../../internals/utils/src/fs.ts
|
|
6
6
|
/**
|
|
7
7
|
* Converts a filesystem path to use POSIX (`/`) separators.
|
|
@@ -49,7 +49,7 @@ var compatibility = {
|
|
|
49
49
|
};
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region package.json
|
|
52
|
-
var version = "5.10.
|
|
52
|
+
var version = "5.10.3";
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/utils.ts
|
|
55
55
|
const SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-barrel",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.3",
|
|
4
4
|
"description": "Barrel-file plugin for Kubb. Automatically generates index.ts re-export files per plugin output directory.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"barrel",
|
|
@@ -49,9 +49,14 @@
|
|
|
49
49
|
"types": "./dist/index.d.ts",
|
|
50
50
|
"exports": {
|
|
51
51
|
".": {
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"default": "./dist/index.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/index.d.cts",
|
|
58
|
+
"default": "./dist/index.cjs"
|
|
59
|
+
}
|
|
55
60
|
},
|
|
56
61
|
"./kubb-extension.json": "./kubb-extension.json",
|
|
57
62
|
"./package.json": "./package.json"
|
|
@@ -61,8 +66,8 @@
|
|
|
61
66
|
"registry": "https://registry.npmjs.org/"
|
|
62
67
|
},
|
|
63
68
|
"dependencies": {
|
|
64
|
-
"@kubb/core": "5.10.
|
|
65
|
-
"@kubb/kit": "5.10.
|
|
69
|
+
"@kubb/core": "5.10.3",
|
|
70
|
+
"@kubb/kit": "5.10.3"
|
|
66
71
|
},
|
|
67
72
|
"devDependencies": {
|
|
68
73
|
"@internals/utils": "0.0.1"
|