@kubb/core 2.4.0 → 2.5.0
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/{chunk-OYDUQYAK.cjs → chunk-3J25BT5A.cjs} +15 -41
- package/dist/chunk-3J25BT5A.cjs.map +1 -0
- package/dist/{chunk-HI4PB2AG.js → chunk-DJBEBMX6.js} +10 -36
- package/dist/chunk-DJBEBMX6.js.map +1 -0
- package/dist/chunk-GLL5G5KY.js +30 -0
- package/dist/chunk-GLL5G5KY.js.map +1 -0
- package/dist/{chunk-BRWCAKW5.cjs → chunk-LDKM6T7X.cjs} +4 -4
- package/dist/{chunk-65OHDKQD.cjs → chunk-N7XIQXXQ.cjs} +28 -5
- package/dist/chunk-N7XIQXXQ.cjs.map +1 -0
- package/dist/{chunk-JSJ3NRBQ.cjs → chunk-SSD2TXQZ.cjs} +51 -32
- package/dist/chunk-SSD2TXQZ.cjs.map +1 -0
- package/dist/{chunk-37XMXECQ.js → chunk-STP2UI5Q.js} +2 -2
- package/dist/{chunk-V6AVJEQC.js → chunk-W3NDP3K4.js} +52 -34
- package/dist/chunk-W3NDP3K4.js.map +1 -0
- package/dist/index.cjs +47 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -56
- package/dist/index.d.ts +54 -56
- package/dist/index.js +19 -20
- package/dist/index.js.map +1 -1
- package/dist/logger-wryz32Ex.d.cts +44 -0
- package/dist/logger-wryz32Ex.d.ts +44 -0
- package/dist/logger.cjs +5 -5
- package/dist/logger.d.cts +2 -32
- package/dist/logger.d.ts +2 -32
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +7 -13
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +6 -12
- package/dist/mocks.js.map +1 -1
- package/dist/transformers.cjs +10 -5
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +13 -3
- package/dist/transformers.d.ts +13 -3
- package/dist/transformers.js +4 -3
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +4 -4
- package/dist/utils.js +2 -2
- package/package.json +3 -3
- package/src/FileManager.ts +2 -2
- package/src/PluginManager.ts +39 -39
- package/src/build.ts +11 -13
- package/src/config.ts +5 -5
- package/src/index.ts +3 -15
- package/src/kubb.ts +11 -0
- package/src/logger.ts +37 -37
- package/src/plugin.ts +5 -5
- package/src/transformers/casing.ts +33 -5
- package/src/transformers/index.ts +3 -2
- package/src/types.ts +23 -23
- package/dist/chunk-65OHDKQD.cjs.map +0 -1
- package/dist/chunk-HI4PB2AG.js.map +0 -1
- package/dist/chunk-JSJ3NRBQ.cjs.map +0 -1
- package/dist/chunk-MASAFU3G.js +0 -15
- package/dist/chunk-MASAFU3G.js.map +0 -1
- package/dist/chunk-OYDUQYAK.cjs.map +0 -1
- package/dist/chunk-V6AVJEQC.js.map +0 -1
- /package/dist/{chunk-37XMXECQ.js.map → chunk-LDKM6T7X.cjs.map} +0 -0
- /package/dist/{chunk-BRWCAKW5.cjs.map → chunk-STP2UI5Q.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import PQueue from 'p-queue';
|
|
2
2
|
import { w as write, r as read } from './write-A6VgHkYA.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TupleToUnion, ObjValueTuple, PossiblePromise, GreaterThan } from '@kubb/types';
|
|
4
4
|
import { DirectoryTreeOptions } from 'directory-tree';
|
|
5
|
-
import { Logger, LogLevel } from './logger.js';
|
|
5
|
+
import { E as EventEmitter, L as Logger, a as LogLevel } from './logger-wryz32Ex.js';
|
|
6
6
|
import 'ora';
|
|
7
7
|
|
|
8
8
|
type BarrelManagerOptions = {
|
|
@@ -14,13 +14,20 @@ type BarrelManagerOptions = {
|
|
|
14
14
|
extName?: KubbFile.Extname;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
type Plugins = _Register;
|
|
18
|
+
type OptionsPlugins = {
|
|
19
|
+
[K in keyof Plugins]: Plugins[K]['options'];
|
|
20
|
+
};
|
|
21
|
+
type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
|
|
22
|
+
type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
|
|
23
|
+
type Plugin$1 = keyof Plugins;
|
|
24
|
+
|
|
25
|
+
type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
|
|
26
|
+
type kubb_OptionsPlugins = OptionsPlugins;
|
|
27
|
+
type kubb_PluginUnion = PluginUnion;
|
|
28
|
+
type kubb_Plugins = Plugins;
|
|
29
|
+
declare namespace kubb {
|
|
30
|
+
export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
@@ -33,14 +40,14 @@ type Strategy$1 = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceAr
|
|
|
33
40
|
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
34
41
|
strategy: Strategy$1;
|
|
35
42
|
hookName: H;
|
|
36
|
-
plugin:
|
|
43
|
+
plugin: Plugin;
|
|
37
44
|
parameters?: unknown[] | undefined;
|
|
38
45
|
output?: unknown;
|
|
39
46
|
};
|
|
40
47
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
41
48
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
42
49
|
result: Result;
|
|
43
|
-
plugin:
|
|
50
|
+
plugin: Plugin;
|
|
44
51
|
};
|
|
45
52
|
type Options$2 = {
|
|
46
53
|
logger: Logger;
|
|
@@ -56,14 +63,14 @@ type Events = {
|
|
|
56
63
|
};
|
|
57
64
|
declare class PluginManager {
|
|
58
65
|
#private;
|
|
59
|
-
readonly plugins:
|
|
66
|
+
readonly plugins: PluginWithLifeCycle[];
|
|
60
67
|
readonly fileManager: FileManager;
|
|
61
68
|
readonly events: EventEmitter<Events>;
|
|
62
|
-
readonly config:
|
|
69
|
+
readonly config: Config;
|
|
63
70
|
readonly executed: Array<Executer>;
|
|
64
71
|
readonly logger: Logger;
|
|
65
72
|
readonly queue: PQueue;
|
|
66
|
-
constructor(config:
|
|
73
|
+
constructor(config: Config, options: Options$2);
|
|
67
74
|
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
68
75
|
resolveName: (params: ResolveNameParams) => string;
|
|
69
76
|
/**
|
|
@@ -74,7 +81,7 @@ declare class PluginManager {
|
|
|
74
81
|
* Run a specific hookName for plugin x.
|
|
75
82
|
*/
|
|
76
83
|
hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
|
|
77
|
-
pluginKey:
|
|
84
|
+
pluginKey: Plugin['key'];
|
|
78
85
|
hookName: H;
|
|
79
86
|
parameters: PluginParameter<H>;
|
|
80
87
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>> | null;
|
|
@@ -82,7 +89,7 @@ declare class PluginManager {
|
|
|
82
89
|
* Run a specific hookName for plugin x.
|
|
83
90
|
*/
|
|
84
91
|
hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
|
|
85
|
-
pluginKey:
|
|
92
|
+
pluginKey: Plugin['key'];
|
|
86
93
|
hookName: H;
|
|
87
94
|
parameters: PluginParameter<H>;
|
|
88
95
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
@@ -92,7 +99,7 @@ declare class PluginManager {
|
|
|
92
99
|
hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
|
|
93
100
|
hookName: H;
|
|
94
101
|
parameters: PluginParameter<H>;
|
|
95
|
-
skipped?: ReadonlySet<
|
|
102
|
+
skipped?: ReadonlySet<Plugin> | null;
|
|
96
103
|
}): Promise<SafeParseResult<H>>;
|
|
97
104
|
/**
|
|
98
105
|
* First non-null result stops and will return it's value.
|
|
@@ -100,7 +107,7 @@ declare class PluginManager {
|
|
|
100
107
|
hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
|
|
101
108
|
hookName: H;
|
|
102
109
|
parameters: PluginParameter<H>;
|
|
103
|
-
skipped?: ReadonlySet<
|
|
110
|
+
skipped?: ReadonlySet<Plugin> | null;
|
|
104
111
|
}): SafeParseResult<H>;
|
|
105
112
|
/**
|
|
106
113
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
@@ -115,7 +122,7 @@ declare class PluginManager {
|
|
|
115
122
|
hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
|
|
116
123
|
hookName: H;
|
|
117
124
|
parameters: PluginParameter<H>;
|
|
118
|
-
reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin:
|
|
125
|
+
reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: Plugin) => PossiblePromise<Argument0<H> | null>;
|
|
119
126
|
}): Promise<Argument0<H>>;
|
|
120
127
|
/**
|
|
121
128
|
* Chains plugins
|
|
@@ -124,8 +131,8 @@ declare class PluginManager {
|
|
|
124
131
|
hookName: H;
|
|
125
132
|
parameters?: PluginParameter<H>;
|
|
126
133
|
}): Promise<void>;
|
|
127
|
-
getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey:
|
|
128
|
-
static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1:
|
|
134
|
+
getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: Plugin['key']): Plugin[];
|
|
135
|
+
static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>] : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>]>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
|
|
129
136
|
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
|
|
130
137
|
}
|
|
131
138
|
|
|
@@ -144,7 +151,7 @@ interface Cache<TStore extends object = object> {
|
|
|
144
151
|
* ...
|
|
145
152
|
* })
|
|
146
153
|
*/
|
|
147
|
-
type
|
|
154
|
+
type UserConfig = Omit<Config, 'root' | 'plugins'> & {
|
|
148
155
|
/**
|
|
149
156
|
* Project root directory. Can be an absolute path, or a path relative from
|
|
150
157
|
* the location of the config file itself.
|
|
@@ -152,11 +159,11 @@ type KubbUserConfig = Omit<KubbConfig, 'root' | 'plugins'> & {
|
|
|
152
159
|
*/
|
|
153
160
|
root?: string;
|
|
154
161
|
/**
|
|
155
|
-
* Plugin type can be KubbJSONPlugin or
|
|
162
|
+
* Plugin type can be KubbJSONPlugin or Plugin
|
|
156
163
|
* Example: ['@kubb/swagger', { output: false }]
|
|
157
164
|
* Or: createSwagger({ output: false })
|
|
158
165
|
*/
|
|
159
|
-
plugins?: Array<Omit<
|
|
166
|
+
plugins?: Array<Omit<UnknownUserPlugin, 'api'> | UnionPlugins | [name: string, options: object]>;
|
|
160
167
|
};
|
|
161
168
|
type InputPath = {
|
|
162
169
|
/**
|
|
@@ -174,7 +181,7 @@ type Input = InputPath | InputData;
|
|
|
174
181
|
/**
|
|
175
182
|
* @private
|
|
176
183
|
*/
|
|
177
|
-
type
|
|
184
|
+
type Config<TInput = Input> = {
|
|
178
185
|
/**
|
|
179
186
|
* Optional config name to show in CLI output
|
|
180
187
|
*/
|
|
@@ -208,7 +215,7 @@ type KubbConfig<TInput = Input> = {
|
|
|
208
215
|
* The plugin/package can forsee some options that you need to pass through.
|
|
209
216
|
* Sometimes a plugin is depended on another plugin, if that's the case you will get an error back from the plugin you installed.
|
|
210
217
|
*/
|
|
211
|
-
plugins?: Array<
|
|
218
|
+
plugins?: Array<Plugin>;
|
|
212
219
|
/**
|
|
213
220
|
* Hooks that will be called when a specific action is triggered in Kubb.
|
|
214
221
|
*/
|
|
@@ -241,8 +248,7 @@ type CLIOptions = {
|
|
|
241
248
|
*/
|
|
242
249
|
logLevel?: LogLevel;
|
|
243
250
|
};
|
|
244
|
-
type
|
|
245
|
-
type KubbObjectPlugin = keyof OptionsPlugins;
|
|
251
|
+
type UnionPlugins = PluginUnion;
|
|
246
252
|
type PluginFactoryOptions<
|
|
247
253
|
/**
|
|
248
254
|
* Name to be used for the plugin, this will also be used for they key.
|
|
@@ -280,11 +286,10 @@ TAppMeta = unknown> = {
|
|
|
280
286
|
resolvePathOptions: TResolvePathOptions;
|
|
281
287
|
appMeta: {
|
|
282
288
|
pluginManager: PluginManager;
|
|
283
|
-
plugin:
|
|
289
|
+
plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
|
|
284
290
|
} & TAppMeta;
|
|
285
291
|
};
|
|
286
|
-
type
|
|
287
|
-
type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
292
|
+
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
288
293
|
/**
|
|
289
294
|
* Unique name used for the plugin
|
|
290
295
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
@@ -309,9 +314,9 @@ type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions
|
|
|
309
314
|
} : {
|
|
310
315
|
api: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['api'];
|
|
311
316
|
});
|
|
312
|
-
type
|
|
313
|
-
type
|
|
314
|
-
type
|
|
317
|
+
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
318
|
+
type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any, any>>;
|
|
319
|
+
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
315
320
|
/**
|
|
316
321
|
* Unique name used for the plugin
|
|
317
322
|
* @example @kubb/typescript
|
|
@@ -340,13 +345,13 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
340
345
|
} : {
|
|
341
346
|
api: TOptions['api'];
|
|
342
347
|
});
|
|
343
|
-
type
|
|
348
|
+
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
344
349
|
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
345
350
|
/**
|
|
346
351
|
* Start of the lifecycle of a plugin.
|
|
347
352
|
* @type hookParallel
|
|
348
353
|
*/
|
|
349
|
-
buildStart?: (this: PluginContext<TOptions>,
|
|
354
|
+
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
350
355
|
/**
|
|
351
356
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
352
357
|
* Options can als be included.
|
|
@@ -386,7 +391,7 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
386
391
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
387
392
|
type PluginCache = Record<string, [number, unknown]>;
|
|
388
393
|
type ResolvePathParams<TOptions = object> = {
|
|
389
|
-
pluginKey?:
|
|
394
|
+
pluginKey?: Plugin['key'];
|
|
390
395
|
baseName: string;
|
|
391
396
|
directory?: string | undefined;
|
|
392
397
|
/**
|
|
@@ -396,7 +401,7 @@ type ResolvePathParams<TOptions = object> = {
|
|
|
396
401
|
};
|
|
397
402
|
type ResolveNameParams = {
|
|
398
403
|
name: string;
|
|
399
|
-
pluginKey?:
|
|
404
|
+
pluginKey?: Plugin['key'];
|
|
400
405
|
/**
|
|
401
406
|
* `file` will be used to customize the name of the created file(use of camelCase)
|
|
402
407
|
* `function` can be used used to customize the exported functions(use of camelCase)
|
|
@@ -405,7 +410,7 @@ type ResolveNameParams = {
|
|
|
405
410
|
type?: 'file' | 'function' | 'type';
|
|
406
411
|
};
|
|
407
412
|
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
408
|
-
config:
|
|
413
|
+
config: Config;
|
|
409
414
|
cache: Cache<PluginCache>;
|
|
410
415
|
fileManager: FileManager;
|
|
411
416
|
pluginManager: PluginManager;
|
|
@@ -416,11 +421,11 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
416
421
|
/**
|
|
417
422
|
* All plugins
|
|
418
423
|
*/
|
|
419
|
-
plugins:
|
|
424
|
+
plugins: Plugin[];
|
|
420
425
|
/**
|
|
421
426
|
* Current plugin
|
|
422
427
|
*/
|
|
423
|
-
plugin:
|
|
428
|
+
plugin: Plugin<TOptions>;
|
|
424
429
|
};
|
|
425
430
|
type TransformResult = string | null;
|
|
426
431
|
|
|
@@ -496,7 +501,7 @@ declare namespace KubbFile {
|
|
|
496
501
|
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
497
502
|
type OptionalPath = Path | undefined | null;
|
|
498
503
|
type FileMetaBase = {
|
|
499
|
-
pluginKey?:
|
|
504
|
+
pluginKey?: Plugin['key'];
|
|
500
505
|
};
|
|
501
506
|
type File<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = {
|
|
502
507
|
/**
|
|
@@ -605,13 +610,13 @@ declare function safeBuild(options: BuildOptions): Promise<BuildOutput>;
|
|
|
605
610
|
|
|
606
611
|
/**
|
|
607
612
|
* Type helper to make it easier to use kubb.config.js
|
|
608
|
-
* accepts a direct {@link
|
|
613
|
+
* accepts a direct {@link Config} object, or a function that returns it.
|
|
609
614
|
* The function receives a {@link ConfigEnv} object that exposes two properties:
|
|
610
615
|
*/
|
|
611
|
-
declare function defineConfig(options: PossiblePromise<
|
|
616
|
+
declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | ((
|
|
612
617
|
/** The options derived from the CLI flags */
|
|
613
|
-
cliOptions: CLIOptions) => PossiblePromise<
|
|
614
|
-
declare function isInputPath(result:
|
|
618
|
+
cliOptions: CLIOptions) => PossiblePromise<UserConfig | Array<UserConfig>>)): typeof options;
|
|
619
|
+
declare function isInputPath(result: Config | undefined): result is Config<InputPath>;
|
|
615
620
|
|
|
616
621
|
/**
|
|
617
622
|
* Behaves as an Error to log a warning in the console(still stops the execution)
|
|
@@ -658,8 +663,8 @@ declare class PackageManager {
|
|
|
658
663
|
isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean;
|
|
659
664
|
}
|
|
660
665
|
|
|
661
|
-
type
|
|
662
|
-
declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory:
|
|
666
|
+
type PluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>;
|
|
667
|
+
declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: PluginFactory<T>): (options: T['options']) => ReturnType<PluginFactory<T>>;
|
|
663
668
|
declare const pluginName = "core";
|
|
664
669
|
|
|
665
670
|
type PromiseFunc$1<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2;
|
|
@@ -682,12 +687,5 @@ declare class PromiseManager<TState = any> {
|
|
|
682
687
|
|
|
683
688
|
interface _Register {
|
|
684
689
|
}
|
|
685
|
-
type Plugins = _Register;
|
|
686
|
-
type OptionsPlugins = {
|
|
687
|
-
[K in keyof Plugins]: Plugins[K]['options'];
|
|
688
|
-
};
|
|
689
|
-
type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
|
|
690
|
-
type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
|
|
691
|
-
type Plugin = keyof Plugins;
|
|
692
690
|
|
|
693
|
-
export { type CLIOptions,
|
|
691
|
+
export { type CLIOptions, type Config, FileManager, Generator, kubb as Kubb, KubbFile, PackageManager, type Plugin, type PluginFactoryOptions, PluginManager, PromiseManager, type ResolveNameParams, type ResolvePathParams, type UserConfig, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { URLPath } from './chunk-
|
|
1
|
+
import { URLPath } from './chunk-STP2UI5Q.js';
|
|
2
2
|
import { clean } from './chunk-IQBEGX4Z.js';
|
|
3
|
-
import { FileManager, PluginManager, isPromise } from './chunk-
|
|
4
|
-
export { FileManager, KubbFile, PluginManager, PromiseManager, Warning, createPlugin, pluginName as name, pluginName } from './chunk-
|
|
3
|
+
import { FileManager, PluginManager, isPromise } from './chunk-DJBEBMX6.js';
|
|
4
|
+
export { FileManager, KubbFile, PluginManager, PromiseManager, Warning, createPlugin, pluginName as name, pluginName } from './chunk-DJBEBMX6.js';
|
|
5
5
|
import './chunk-GKW5TTFV.js';
|
|
6
6
|
import './chunk-YW33IVCC.js';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import { LogLevel, createLogger, p, randomCliColour } from './chunk-
|
|
7
|
+
import './chunk-GLL5G5KY.js';
|
|
8
|
+
import { LogLevel, createLogger, p, randomCliColour } from './chunk-W3NDP3K4.js';
|
|
9
9
|
import { read, readSync } from './chunk-YUTCMBUY.js';
|
|
10
10
|
import './chunk-MYC5HIA5.js';
|
|
11
11
|
import { init_esm_shims, __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-ETA3LCRB.js';
|
|
@@ -95,13 +95,13 @@ async function setup(options) {
|
|
|
95
95
|
const pluginManager = new PluginManager(config, { logger, task });
|
|
96
96
|
pluginManager.on("execute", (executer) => {
|
|
97
97
|
const { hookName, parameters, plugin } = executer;
|
|
98
|
-
if (hookName === "writeFile"
|
|
98
|
+
if (hookName === "writeFile") {
|
|
99
99
|
const [code] = parameters;
|
|
100
100
|
if (logger.logLevel === LogLevel.debug) {
|
|
101
|
-
logger.debug
|
|
101
|
+
logger.emit("debug", [`PluginKey ${p.dim(JSON.stringify(plugin.key))}
|
|
102
102
|
with source
|
|
103
103
|
|
|
104
|
-
${code}`);
|
|
104
|
+
${code}`]);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
});
|
|
@@ -109,8 +109,8 @@ ${code}`);
|
|
|
109
109
|
if (logger.logLevel !== LogLevel.info) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
if (
|
|
113
|
-
logger.
|
|
112
|
+
if (count === 0) {
|
|
113
|
+
logger.emit("start", `\u{1F4BE} Writing`);
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
pluginManager.queue.on("active", () => {
|
|
@@ -142,7 +142,7 @@ ${code}`);
|
|
|
142
142
|
output && `${p.bgWhite("Output")} ${randomCliColour(plugin.name)} ${hookName}`,
|
|
143
143
|
output
|
|
144
144
|
].filter(Boolean);
|
|
145
|
-
logger.
|
|
145
|
+
logger.emit("debug", logs);
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
return pluginManager;
|
|
@@ -155,9 +155,8 @@ async function build(options) {
|
|
|
155
155
|
parameters: [options.config]
|
|
156
156
|
});
|
|
157
157
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
158
|
-
if (logger.logLevel === LogLevel.info
|
|
159
|
-
logger.
|
|
160
|
-
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
158
|
+
if (logger.logLevel === LogLevel.info) {
|
|
159
|
+
logger.emit("end", `\u{1F4BE} Writing completed`);
|
|
161
160
|
}
|
|
162
161
|
return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager };
|
|
163
162
|
}
|
|
@@ -170,9 +169,8 @@ async function safeBuild(options) {
|
|
|
170
169
|
parameters: [options.config]
|
|
171
170
|
});
|
|
172
171
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
173
|
-
if (logger.logLevel === LogLevel.info
|
|
174
|
-
logger.
|
|
175
|
-
logger.spinner.succeed(`\u{1F4BE} Writing completed`);
|
|
172
|
+
if (logger.logLevel === LogLevel.info) {
|
|
173
|
+
logger.emit("end", `\u{1F4BE} Writing completed`);
|
|
176
174
|
}
|
|
177
175
|
} catch (e) {
|
|
178
176
|
return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e };
|
|
@@ -341,9 +339,10 @@ match_fn = function(packageJSON, dependency) {
|
|
|
341
339
|
__privateAdd(_PackageManager, _cache, {});
|
|
342
340
|
var PackageManager = _PackageManager;
|
|
343
341
|
|
|
344
|
-
// src/
|
|
345
|
-
var
|
|
342
|
+
// src/kubb.ts
|
|
343
|
+
var kubb_exports = {};
|
|
344
|
+
init_esm_shims();
|
|
346
345
|
|
|
347
|
-
export { Generator, PackageManager, build,
|
|
346
|
+
export { Generator, kubb_exports as Kubb, PackageManager, build, build as default, defineConfig, isInputPath, safeBuild };
|
|
348
347
|
//# sourceMappingURL=out.js.map
|
|
349
348
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts"],"names":["require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAiE;AAC3F,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,e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AqC,SAAqC;AACpF,UAAM,iBAAiB,KAAK,eAAe,UAAU;AAErD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AJQP,IAAO,cAAQ","sourcesContent":["import { build } from './build.ts'\n\nimport type { ObjValueTuple, TupleToUnion } from '@kubb/types'\n\nexport { build, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type * from './types.ts'\n\nexport interface _Register {}\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n\nexport default build\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { KubbPlugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: KubbPlugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile' && logger.spinner) {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.debug(`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`)\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && count === 0) {\n logger.spinner?.start(`💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.debug(logs.join('\\n'))\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, InputPath, KubbConfig, KubbUserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link KubbConfig} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../src/kubb.ts"],"names":["require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,SAA+C;AAClE,QAAM,EAAE,QAAQ,SAAS,aAAa,EAAE,UAAU,SAAS,OAAO,CAAC,EAAE,IAAI;AACzE,MAAI,QAAQ;AAEZ,MAAI;AACF,QAAI,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ,OAAO,MAAM,IAAI,EAAE,OAAO;AAChE,YAAM,KAAK,OAAO,MAAM,IAAI;AAAA,IAC9B;AAAA,EACF,SAAS,GAAG;AACV,QAAI,YAAY,MAAM,GAAG;AACvB,YAAM,IAAI;AAAA,QACR,kHAAkH,EAAE,IAAI,OAAO,MAAM,IAAI;AAAA,QACzI;AAAA,UACE,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO,OAAO,OAAO;AACvB,UAAM,MAAM,OAAO,OAAO,IAAI;AAAA,EAChC;AAEA,QAAM,OAAO,OAAO,SAAgE;AAClF,UAAM,EAAE,KAAK,IAAI;AAEjB,QAAI,SAAwB,YAAY,UAAU,IAAI;AAEtD,UAAM,EAAE,QAAQ,aAAa,IAAI,MAAM,cAAc,UAAU;AAA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WAAO,sBAAK,kBAAL,WAAY,aAAa;AAAA,EAClC;AAAA,EAEA,MAAM,QAAQ,YAAqC,SAA8C;AAC/F,UAAM,iBAAiB,MAAM,KAAK,WAAW,UAAU;AAEvD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,mBAAmB,SAAS;AAC9B,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AAAA,EACA,YAAY,YAAqC,SAAqC;AACpF,UAAM,iBAAiB,KAAK,eAAe,UAAU;AAErD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AClBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type { CLIOptions, Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams, UserConfig } from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Ora } from 'ora';
|
|
2
|
+
|
|
3
|
+
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor();
|
|
6
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
|
|
7
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
8
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
9
|
+
removeAll(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const LogLevel: {
|
|
13
|
+
readonly silent: "silent";
|
|
14
|
+
readonly info: "info";
|
|
15
|
+
readonly debug: "debug";
|
|
16
|
+
};
|
|
17
|
+
type LogLevel = keyof typeof LogLevel;
|
|
18
|
+
type Events = {
|
|
19
|
+
start: [message: string];
|
|
20
|
+
end: [message: string];
|
|
21
|
+
error: [message: string];
|
|
22
|
+
warning: [message: string];
|
|
23
|
+
debug: [logs: string[]];
|
|
24
|
+
};
|
|
25
|
+
type Logger = {
|
|
26
|
+
/**
|
|
27
|
+
* Optional config name to show in CLI output
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
logLevel: LogLevel;
|
|
31
|
+
spinner?: Ora;
|
|
32
|
+
on: EventEmitter<Events>['on'];
|
|
33
|
+
emit: EventEmitter<Events>['emit'];
|
|
34
|
+
};
|
|
35
|
+
type Props = {
|
|
36
|
+
name?: string;
|
|
37
|
+
logLevel: LogLevel;
|
|
38
|
+
spinner?: Ora;
|
|
39
|
+
};
|
|
40
|
+
declare function createLogger({ logLevel, name, spinner }: Props): Logger;
|
|
41
|
+
declare function randomColour(text?: string, colours?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
|
|
42
|
+
declare function randomCliColour(text?: string, colors?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
|
|
43
|
+
|
|
44
|
+
export { EventEmitter as E, type Logger as L, LogLevel as a, randomCliColour as b, createLogger as c, randomColour as r };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Ora } from 'ora';
|
|
2
|
+
|
|
3
|
+
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor();
|
|
6
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
|
|
7
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
8
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
9
|
+
removeAll(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const LogLevel: {
|
|
13
|
+
readonly silent: "silent";
|
|
14
|
+
readonly info: "info";
|
|
15
|
+
readonly debug: "debug";
|
|
16
|
+
};
|
|
17
|
+
type LogLevel = keyof typeof LogLevel;
|
|
18
|
+
type Events = {
|
|
19
|
+
start: [message: string];
|
|
20
|
+
end: [message: string];
|
|
21
|
+
error: [message: string];
|
|
22
|
+
warning: [message: string];
|
|
23
|
+
debug: [logs: string[]];
|
|
24
|
+
};
|
|
25
|
+
type Logger = {
|
|
26
|
+
/**
|
|
27
|
+
* Optional config name to show in CLI output
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
logLevel: LogLevel;
|
|
31
|
+
spinner?: Ora;
|
|
32
|
+
on: EventEmitter<Events>['on'];
|
|
33
|
+
emit: EventEmitter<Events>['emit'];
|
|
34
|
+
};
|
|
35
|
+
type Props = {
|
|
36
|
+
name?: string;
|
|
37
|
+
logLevel: LogLevel;
|
|
38
|
+
spinner?: Ora;
|
|
39
|
+
};
|
|
40
|
+
declare function createLogger({ logLevel, name, spinner }: Props): Logger;
|
|
41
|
+
declare function randomColour(text?: string, colours?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
|
|
42
|
+
declare function randomCliColour(text?: string, colors?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
|
|
43
|
+
|
|
44
|
+
export { EventEmitter as E, type Logger as L, LogLevel as a, randomCliColour as b, createLogger as c, randomColour as r };
|
package/dist/logger.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSSD2TXQZ_cjs = require('./chunk-SSD2TXQZ.cjs');
|
|
4
4
|
require('./chunk-DM53DOLW.cjs');
|
|
5
5
|
require('./chunk-KAA3L7N6.cjs');
|
|
6
6
|
|
|
@@ -8,19 +8,19 @@ require('./chunk-KAA3L7N6.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "LogLevel", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkSSD2TXQZ_cjs.LogLevel; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "createLogger", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkSSD2TXQZ_cjs.createLogger; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "randomCliColour", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkSSD2TXQZ_cjs.randomCliColour; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "randomColour", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkSSD2TXQZ_cjs.randomColour; }
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=out.js.map
|
|
26
26
|
//# sourceMappingURL=logger.cjs.map
|