@kubb/core 2.0.0-alpha.7 → 2.0.0-alpha.9
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.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/PluginManager.ts +5 -4
- package/src/types.ts +5 -0
- package/src/utils/executeStrategies.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -111,7 +111,7 @@ declare class PluginManager {
|
|
|
111
111
|
readonly executed: Executer[];
|
|
112
112
|
readonly logger: Logger;
|
|
113
113
|
constructor(config: KubbConfig, options: Options$2);
|
|
114
|
-
resolvePath: (params: ResolvePathParams) => KubbFile.OptionalPath;
|
|
114
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
115
115
|
resolveName: (params: ResolveNameParams) => string;
|
|
116
116
|
on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
|
|
117
117
|
/**
|
|
@@ -452,6 +452,11 @@ type ResolvePathParams<TOptions = object> = {
|
|
|
452
452
|
type ResolveNameParams = {
|
|
453
453
|
name: string;
|
|
454
454
|
pluginKey?: KubbPlugin['key'];
|
|
455
|
+
/**
|
|
456
|
+
* `file` will be used to customize the name of the created file(use of camelCase)
|
|
457
|
+
* `function` can be used used to customize the exported functions(use of camelCase)
|
|
458
|
+
* `type` is a special type for TypeScript(use of PascalCase)
|
|
459
|
+
*/
|
|
455
460
|
type?: 'file' | 'function' | 'type';
|
|
456
461
|
};
|
|
457
462
|
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
@@ -701,7 +706,7 @@ type PromiseFunc$1<T = unknown, T2 = never> = (state: T) => T2 extends never ? P
|
|
|
701
706
|
type ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc$1<infer X, infer Y>> ? X | Y : never;
|
|
702
707
|
type SeqOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = Array<Awaited<ValueOfPromiseFuncArray<TInput>>>;
|
|
703
708
|
type HookFirstOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>;
|
|
704
|
-
type Strategy = 'seq' | 'first';
|
|
709
|
+
type Strategy = 'seq' | 'first' | 'parallel' | 'reduceArg0';
|
|
705
710
|
type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = TStrategy extends 'first' ? HookFirstOutput<TInput, TValue> : TStrategy extends 'seq' ? SeqOutput<TInput, TValue> : never;
|
|
706
711
|
|
|
707
712
|
type PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ declare class PluginManager {
|
|
|
111
111
|
readonly executed: Executer[];
|
|
112
112
|
readonly logger: Logger;
|
|
113
113
|
constructor(config: KubbConfig, options: Options$2);
|
|
114
|
-
resolvePath: (params: ResolvePathParams) => KubbFile.OptionalPath;
|
|
114
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
115
115
|
resolveName: (params: ResolveNameParams) => string;
|
|
116
116
|
on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
|
|
117
117
|
/**
|
|
@@ -452,6 +452,11 @@ type ResolvePathParams<TOptions = object> = {
|
|
|
452
452
|
type ResolveNameParams = {
|
|
453
453
|
name: string;
|
|
454
454
|
pluginKey?: KubbPlugin['key'];
|
|
455
|
+
/**
|
|
456
|
+
* `file` will be used to customize the name of the created file(use of camelCase)
|
|
457
|
+
* `function` can be used used to customize the exported functions(use of camelCase)
|
|
458
|
+
* `type` is a special type for TypeScript(use of PascalCase)
|
|
459
|
+
*/
|
|
455
460
|
type?: 'file' | 'function' | 'type';
|
|
456
461
|
};
|
|
457
462
|
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
@@ -701,7 +706,7 @@ type PromiseFunc$1<T = unknown, T2 = never> = (state: T) => T2 extends never ? P
|
|
|
701
706
|
type ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc$1<infer X, infer Y>> ? X | Y : never;
|
|
702
707
|
type SeqOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = Array<Awaited<ValueOfPromiseFuncArray<TInput>>>;
|
|
703
708
|
type HookFirstOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>;
|
|
704
|
-
type Strategy = 'seq' | 'first';
|
|
709
|
+
type Strategy = 'seq' | 'first' | 'parallel' | 'reduceArg0';
|
|
705
710
|
type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = TStrategy extends 'first' ? HookFirstOutput<TInput, TValue> : TStrategy extends 'seq' ? SeqOutput<TInput, TValue> : never;
|
|
706
711
|
|
|
707
712
|
type PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
|