@kubb/plugin-msw 4.11.0 → 4.11.2
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/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/{index-CuAGeEkO.d.cts → index-B8yvSsLX.d.ts} +61 -30
- package/dist/{index-h4uz5Q5r.d.ts → index-BSYdDKeZ.d.cts} +61 -30
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/{types-Ce1F6lV4.d.cts → types-BUzgaOhd.d.ts} +5 -3
- package/dist/{types-Csv4cYBx.d.ts → types-MDRyMp8X.d.cts} +5 -3
- package/package.json +6 -6
- package/src/plugin.ts +1 -0
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
1
|
+
import "./index-BSYdDKeZ.cjs";
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-MDRyMp8X.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
5
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
1
|
+
import "./index-B8yvSsLX.js";
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-BUzgaOhd.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
5
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
1
2
|
import * as OasTypes from "oas/types";
|
|
2
3
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
4
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -5,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
7
|
import BaseOas from "oas";
|
|
7
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
|
|
11
11
|
//#region ../oas/src/types.d.ts
|
|
@@ -72,13 +72,35 @@ type DebugEvent = {
|
|
|
72
72
|
date: Date;
|
|
73
73
|
logs: string[];
|
|
74
74
|
fileName?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Category of the debug log, used for GitHub Actions grouping
|
|
77
|
+
* - 'setup': Initial configuration and environment setup
|
|
78
|
+
* - 'plugin': Plugin installation and execution
|
|
79
|
+
* - 'hook': Plugin hook execution details
|
|
80
|
+
* - 'schema': Schema parsing and generation
|
|
81
|
+
* - 'file': File operations (read/write/generate)
|
|
82
|
+
* - 'error': Error details and stack traces
|
|
83
|
+
* - undefined: Generic logs (always inline)
|
|
84
|
+
*/
|
|
85
|
+
category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
|
|
86
|
+
/**
|
|
87
|
+
* Plugin name for grouping plugin-specific logs together
|
|
88
|
+
*/
|
|
89
|
+
pluginName?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Indicates if this is the start or end of a plugin's execution
|
|
92
|
+
* - 'start': Start of plugin execution group
|
|
93
|
+
* - 'end': End of plugin execution group
|
|
94
|
+
*/
|
|
95
|
+
pluginGroupMarker?: 'start' | 'end';
|
|
75
96
|
};
|
|
76
97
|
type Events$1 = {
|
|
77
98
|
start: [message: string];
|
|
78
99
|
success: [message: string];
|
|
79
|
-
error: [message: string,
|
|
100
|
+
error: [message: string, error: Error];
|
|
80
101
|
warning: [message: string];
|
|
81
102
|
debug: [DebugEvent];
|
|
103
|
+
verbose: [DebugEvent];
|
|
82
104
|
info: [message: string];
|
|
83
105
|
progress_start: [{
|
|
84
106
|
id: string;
|
|
@@ -102,7 +124,7 @@ type Logger = {
|
|
|
102
124
|
consola?: ConsolaInstance;
|
|
103
125
|
on: EventEmitter<Events$1>['on'];
|
|
104
126
|
emit: EventEmitter<Events$1>['emit'];
|
|
105
|
-
writeLogs: () => Promise<
|
|
127
|
+
writeLogs: () => Promise<void>;
|
|
106
128
|
};
|
|
107
129
|
//#endregion
|
|
108
130
|
//#region ../core/src/utils/types.d.ts
|
|
@@ -413,14 +435,35 @@ type Group = {
|
|
|
413
435
|
//#region ../core/src/PluginManager.d.ts
|
|
414
436
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
415
437
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
416
|
-
type
|
|
417
|
-
|
|
438
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
439
|
+
strategy: Strategy;
|
|
440
|
+
hookName: H;
|
|
441
|
+
plugin: Plugin;
|
|
442
|
+
parameters?: unknown[] | undefined;
|
|
443
|
+
output?: unknown;
|
|
444
|
+
};
|
|
445
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
446
|
+
duration: number;
|
|
418
447
|
strategy: Strategy;
|
|
419
448
|
hookName: H;
|
|
420
449
|
plugin: Plugin;
|
|
421
450
|
parameters?: unknown[] | undefined;
|
|
422
451
|
output?: unknown;
|
|
423
452
|
};
|
|
453
|
+
type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
454
|
+
hookName: H;
|
|
455
|
+
duration: number;
|
|
456
|
+
strategy: Strategy;
|
|
457
|
+
parameters?: unknown[] | undefined;
|
|
458
|
+
plugin: Plugin;
|
|
459
|
+
};
|
|
460
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
461
|
+
hookName: H;
|
|
462
|
+
plugins: Array<Plugin>;
|
|
463
|
+
};
|
|
464
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
465
|
+
hookName: H;
|
|
466
|
+
};
|
|
424
467
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
425
468
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
426
469
|
result: Result;
|
|
@@ -435,9 +478,11 @@ type Options = {
|
|
|
435
478
|
concurrency?: number;
|
|
436
479
|
};
|
|
437
480
|
type Events = {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
481
|
+
progress_start: [meta: ProgressStartMeta];
|
|
482
|
+
progress_stop: [meta: ProgressStopMeta];
|
|
483
|
+
executing: [meta: ExecutingMeta];
|
|
484
|
+
executed: [meta: ExecutedMeta];
|
|
485
|
+
error: [error: Error, meta: ErrorMeta];
|
|
441
486
|
};
|
|
442
487
|
type GetFileProps<TOptions = object> = {
|
|
443
488
|
name: string;
|
|
@@ -450,8 +495,6 @@ declare class PluginManager {
|
|
|
450
495
|
#private;
|
|
451
496
|
readonly events: EventEmitter<Events>;
|
|
452
497
|
readonly config: Config;
|
|
453
|
-
readonly executed: Array<Executer>;
|
|
454
|
-
readonly logger: Logger;
|
|
455
498
|
readonly options: Options;
|
|
456
499
|
constructor(config: Config, options: Options);
|
|
457
500
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
@@ -477,13 +520,11 @@ declare class PluginManager {
|
|
|
477
520
|
hookForPlugin<H extends PluginLifecycleHooks>({
|
|
478
521
|
pluginKey,
|
|
479
522
|
hookName,
|
|
480
|
-
parameters
|
|
481
|
-
message
|
|
523
|
+
parameters
|
|
482
524
|
}: {
|
|
483
525
|
pluginKey: Plugin['key'];
|
|
484
526
|
hookName: H;
|
|
485
527
|
parameters: PluginParameter<H>;
|
|
486
|
-
message: string;
|
|
487
528
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>>;
|
|
488
529
|
/**
|
|
489
530
|
* Run a specific hookName for plugin x.
|
|
@@ -491,13 +532,11 @@ declare class PluginManager {
|
|
|
491
532
|
hookForPluginSync<H extends PluginLifecycleHooks>({
|
|
492
533
|
pluginKey,
|
|
493
534
|
hookName,
|
|
494
|
-
parameters
|
|
495
|
-
message
|
|
535
|
+
parameters
|
|
496
536
|
}: {
|
|
497
537
|
pluginKey: Plugin['key'];
|
|
498
538
|
hookName: H;
|
|
499
539
|
parameters: PluginParameter<H>;
|
|
500
|
-
message: string;
|
|
501
540
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
502
541
|
/**
|
|
503
542
|
* First non-null result stops and will return it's value.
|
|
@@ -505,13 +544,11 @@ declare class PluginManager {
|
|
|
505
544
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
506
545
|
hookName,
|
|
507
546
|
parameters,
|
|
508
|
-
skipped
|
|
509
|
-
message
|
|
547
|
+
skipped
|
|
510
548
|
}: {
|
|
511
549
|
hookName: H;
|
|
512
550
|
parameters: PluginParameter<H>;
|
|
513
551
|
skipped?: ReadonlySet<Plugin> | null;
|
|
514
|
-
message: string;
|
|
515
552
|
}): Promise<SafeParseResult<H>>;
|
|
516
553
|
/**
|
|
517
554
|
* First non-null result stops and will return it's value.
|
|
@@ -519,37 +556,31 @@ declare class PluginManager {
|
|
|
519
556
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
520
557
|
hookName,
|
|
521
558
|
parameters,
|
|
522
|
-
skipped
|
|
523
|
-
message
|
|
559
|
+
skipped
|
|
524
560
|
}: {
|
|
525
561
|
hookName: H;
|
|
526
562
|
parameters: PluginParameter<H>;
|
|
527
563
|
skipped?: ReadonlySet<Plugin> | null;
|
|
528
|
-
message: string;
|
|
529
564
|
}): SafeParseResult<H>;
|
|
530
565
|
/**
|
|
531
566
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
532
567
|
*/
|
|
533
568
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
|
|
534
569
|
hookName,
|
|
535
|
-
parameters
|
|
536
|
-
message
|
|
570
|
+
parameters
|
|
537
571
|
}: {
|
|
538
572
|
hookName: H;
|
|
539
573
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
540
|
-
message: string;
|
|
541
574
|
}): Promise<Awaited<TOuput>[]>;
|
|
542
575
|
/**
|
|
543
576
|
* Chains plugins
|
|
544
577
|
*/
|
|
545
578
|
hookSeq<H extends PluginLifecycleHooks>({
|
|
546
579
|
hookName,
|
|
547
|
-
parameters
|
|
548
|
-
message
|
|
580
|
+
parameters
|
|
549
581
|
}: {
|
|
550
582
|
hookName: H;
|
|
551
583
|
parameters?: PluginParameter<H>;
|
|
552
|
-
message: string;
|
|
553
584
|
}): Promise<void>;
|
|
554
585
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
555
586
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
@@ -560,5 +591,5 @@ type FileMetaBase = {
|
|
|
560
591
|
pluginKey?: Plugin['key'];
|
|
561
592
|
};
|
|
562
593
|
//#endregion
|
|
563
|
-
export { Output as a, ResolveNameParams as c,
|
|
564
|
-
//# sourceMappingURL=index-
|
|
594
|
+
export { Output as a, ResolveNameParams as c, BaseGenerator as d, Oas as f, contentType as g, SchemaObject$1 as h, Group as i, UserPluginWithLifeCycle as l, Operation$1 as m, PluginManager as n, Plugin as o, HttpMethod as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, Logger as u };
|
|
595
|
+
//# sourceMappingURL=index-B8yvSsLX.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
2
1
|
import * as OasTypes from "oas/types";
|
|
3
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -6,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
6
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
6
|
import BaseOas from "oas";
|
|
8
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
|
|
11
11
|
//#region ../oas/src/types.d.ts
|
|
@@ -72,13 +72,35 @@ type DebugEvent = {
|
|
|
72
72
|
date: Date;
|
|
73
73
|
logs: string[];
|
|
74
74
|
fileName?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Category of the debug log, used for GitHub Actions grouping
|
|
77
|
+
* - 'setup': Initial configuration and environment setup
|
|
78
|
+
* - 'plugin': Plugin installation and execution
|
|
79
|
+
* - 'hook': Plugin hook execution details
|
|
80
|
+
* - 'schema': Schema parsing and generation
|
|
81
|
+
* - 'file': File operations (read/write/generate)
|
|
82
|
+
* - 'error': Error details and stack traces
|
|
83
|
+
* - undefined: Generic logs (always inline)
|
|
84
|
+
*/
|
|
85
|
+
category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
|
|
86
|
+
/**
|
|
87
|
+
* Plugin name for grouping plugin-specific logs together
|
|
88
|
+
*/
|
|
89
|
+
pluginName?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Indicates if this is the start or end of a plugin's execution
|
|
92
|
+
* - 'start': Start of plugin execution group
|
|
93
|
+
* - 'end': End of plugin execution group
|
|
94
|
+
*/
|
|
95
|
+
pluginGroupMarker?: 'start' | 'end';
|
|
75
96
|
};
|
|
76
97
|
type Events$1 = {
|
|
77
98
|
start: [message: string];
|
|
78
99
|
success: [message: string];
|
|
79
|
-
error: [message: string,
|
|
100
|
+
error: [message: string, error: Error];
|
|
80
101
|
warning: [message: string];
|
|
81
102
|
debug: [DebugEvent];
|
|
103
|
+
verbose: [DebugEvent];
|
|
82
104
|
info: [message: string];
|
|
83
105
|
progress_start: [{
|
|
84
106
|
id: string;
|
|
@@ -102,7 +124,7 @@ type Logger = {
|
|
|
102
124
|
consola?: ConsolaInstance;
|
|
103
125
|
on: EventEmitter<Events$1>['on'];
|
|
104
126
|
emit: EventEmitter<Events$1>['emit'];
|
|
105
|
-
writeLogs: () => Promise<
|
|
127
|
+
writeLogs: () => Promise<void>;
|
|
106
128
|
};
|
|
107
129
|
//#endregion
|
|
108
130
|
//#region ../core/src/utils/types.d.ts
|
|
@@ -413,14 +435,35 @@ type Group = {
|
|
|
413
435
|
//#region ../core/src/PluginManager.d.ts
|
|
414
436
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
415
437
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
416
|
-
type
|
|
417
|
-
|
|
438
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
439
|
+
strategy: Strategy;
|
|
440
|
+
hookName: H;
|
|
441
|
+
plugin: Plugin;
|
|
442
|
+
parameters?: unknown[] | undefined;
|
|
443
|
+
output?: unknown;
|
|
444
|
+
};
|
|
445
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
446
|
+
duration: number;
|
|
418
447
|
strategy: Strategy;
|
|
419
448
|
hookName: H;
|
|
420
449
|
plugin: Plugin;
|
|
421
450
|
parameters?: unknown[] | undefined;
|
|
422
451
|
output?: unknown;
|
|
423
452
|
};
|
|
453
|
+
type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
454
|
+
hookName: H;
|
|
455
|
+
duration: number;
|
|
456
|
+
strategy: Strategy;
|
|
457
|
+
parameters?: unknown[] | undefined;
|
|
458
|
+
plugin: Plugin;
|
|
459
|
+
};
|
|
460
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
461
|
+
hookName: H;
|
|
462
|
+
plugins: Array<Plugin>;
|
|
463
|
+
};
|
|
464
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
465
|
+
hookName: H;
|
|
466
|
+
};
|
|
424
467
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
425
468
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
426
469
|
result: Result;
|
|
@@ -435,9 +478,11 @@ type Options = {
|
|
|
435
478
|
concurrency?: number;
|
|
436
479
|
};
|
|
437
480
|
type Events = {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
481
|
+
progress_start: [meta: ProgressStartMeta];
|
|
482
|
+
progress_stop: [meta: ProgressStopMeta];
|
|
483
|
+
executing: [meta: ExecutingMeta];
|
|
484
|
+
executed: [meta: ExecutedMeta];
|
|
485
|
+
error: [error: Error, meta: ErrorMeta];
|
|
441
486
|
};
|
|
442
487
|
type GetFileProps<TOptions = object> = {
|
|
443
488
|
name: string;
|
|
@@ -450,8 +495,6 @@ declare class PluginManager {
|
|
|
450
495
|
#private;
|
|
451
496
|
readonly events: EventEmitter<Events>;
|
|
452
497
|
readonly config: Config;
|
|
453
|
-
readonly executed: Array<Executer>;
|
|
454
|
-
readonly logger: Logger;
|
|
455
498
|
readonly options: Options;
|
|
456
499
|
constructor(config: Config, options: Options);
|
|
457
500
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
@@ -477,13 +520,11 @@ declare class PluginManager {
|
|
|
477
520
|
hookForPlugin<H extends PluginLifecycleHooks>({
|
|
478
521
|
pluginKey,
|
|
479
522
|
hookName,
|
|
480
|
-
parameters
|
|
481
|
-
message
|
|
523
|
+
parameters
|
|
482
524
|
}: {
|
|
483
525
|
pluginKey: Plugin['key'];
|
|
484
526
|
hookName: H;
|
|
485
527
|
parameters: PluginParameter<H>;
|
|
486
|
-
message: string;
|
|
487
528
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>>;
|
|
488
529
|
/**
|
|
489
530
|
* Run a specific hookName for plugin x.
|
|
@@ -491,13 +532,11 @@ declare class PluginManager {
|
|
|
491
532
|
hookForPluginSync<H extends PluginLifecycleHooks>({
|
|
492
533
|
pluginKey,
|
|
493
534
|
hookName,
|
|
494
|
-
parameters
|
|
495
|
-
message
|
|
535
|
+
parameters
|
|
496
536
|
}: {
|
|
497
537
|
pluginKey: Plugin['key'];
|
|
498
538
|
hookName: H;
|
|
499
539
|
parameters: PluginParameter<H>;
|
|
500
|
-
message: string;
|
|
501
540
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
502
541
|
/**
|
|
503
542
|
* First non-null result stops and will return it's value.
|
|
@@ -505,13 +544,11 @@ declare class PluginManager {
|
|
|
505
544
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
506
545
|
hookName,
|
|
507
546
|
parameters,
|
|
508
|
-
skipped
|
|
509
|
-
message
|
|
547
|
+
skipped
|
|
510
548
|
}: {
|
|
511
549
|
hookName: H;
|
|
512
550
|
parameters: PluginParameter<H>;
|
|
513
551
|
skipped?: ReadonlySet<Plugin> | null;
|
|
514
|
-
message: string;
|
|
515
552
|
}): Promise<SafeParseResult<H>>;
|
|
516
553
|
/**
|
|
517
554
|
* First non-null result stops and will return it's value.
|
|
@@ -519,37 +556,31 @@ declare class PluginManager {
|
|
|
519
556
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
520
557
|
hookName,
|
|
521
558
|
parameters,
|
|
522
|
-
skipped
|
|
523
|
-
message
|
|
559
|
+
skipped
|
|
524
560
|
}: {
|
|
525
561
|
hookName: H;
|
|
526
562
|
parameters: PluginParameter<H>;
|
|
527
563
|
skipped?: ReadonlySet<Plugin> | null;
|
|
528
|
-
message: string;
|
|
529
564
|
}): SafeParseResult<H>;
|
|
530
565
|
/**
|
|
531
566
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
532
567
|
*/
|
|
533
568
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
|
|
534
569
|
hookName,
|
|
535
|
-
parameters
|
|
536
|
-
message
|
|
570
|
+
parameters
|
|
537
571
|
}: {
|
|
538
572
|
hookName: H;
|
|
539
573
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
540
|
-
message: string;
|
|
541
574
|
}): Promise<Awaited<TOuput>[]>;
|
|
542
575
|
/**
|
|
543
576
|
* Chains plugins
|
|
544
577
|
*/
|
|
545
578
|
hookSeq<H extends PluginLifecycleHooks>({
|
|
546
579
|
hookName,
|
|
547
|
-
parameters
|
|
548
|
-
message
|
|
580
|
+
parameters
|
|
549
581
|
}: {
|
|
550
582
|
hookName: H;
|
|
551
583
|
parameters?: PluginParameter<H>;
|
|
552
|
-
message: string;
|
|
553
584
|
}): Promise<void>;
|
|
554
585
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
555
586
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
@@ -560,5 +591,5 @@ type FileMetaBase = {
|
|
|
560
591
|
pluginKey?: Plugin['key'];
|
|
561
592
|
};
|
|
562
593
|
//#endregion
|
|
563
|
-
export { Output as a, ResolveNameParams as c,
|
|
564
|
-
//# sourceMappingURL=index-
|
|
594
|
+
export { Output as a, ResolveNameParams as c, BaseGenerator as d, Oas as f, contentType as g, SchemaObject$1 as h, Group as i, UserPluginWithLifeCycle as l, Operation$1 as m, PluginManager as n, Plugin as o, HttpMethod as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, Logger as u };
|
|
595
|
+
//# sourceMappingURL=index-BSYdDKeZ.d.cts.map
|
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mswGenerator","handlersGenerator","pluginOasName","pluginTsName","pluginFakerName","path","options","groupName: Group['name']","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = definePlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAACA,iCAAc,WAAWC,uCAAoB,OAAU,CAAC,OAAO,QAAQ,EACrF,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAACC;GAAeC;GAAc,WAAW,UAAUC,sCAAkB;GAAU,CAAC,OAAO,QAAQ;EACpG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,2CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mswGenerator","handlersGenerator","pluginOasName","pluginTsName","pluginFakerName","path","options","groupName: Group['name']","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = definePlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAACA,iCAAc,WAAWC,uCAAoB,OAAU,CAAC,OAAO,QAAQ,EACrF,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAACC;GAAeC;GAAc,WAAW,UAAUC,sCAAkB;GAAU,CAAC,OAAO,QAAQ;EACpG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,2CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAIG,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as UserPluginWithLifeCycle } from "./index-
|
|
2
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
1
|
+
import { l as UserPluginWithLifeCycle } from "./index-BSYdDKeZ.cjs";
|
|
2
|
+
import { n as PluginMsw, t as Options } from "./types-MDRyMp8X.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as UserPluginWithLifeCycle } from "./index-
|
|
2
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
1
|
+
import { l as UserPluginWithLifeCycle } from "./index-B8yvSsLX.js";
|
|
2
|
+
import { n as PluginMsw, t as Options } from "./types-BUzgaOhd.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = definePlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAAC,cAAc,WAAW,oBAAoB,OAAU,CAAC,OAAO,QAAQ,EACrF,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,UAAU,kBAAkB;GAAU,CAAC,OAAO,QAAQ;EACpG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = definePlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAAC,cAAc,WAAW,oBAAoB,OAAU,CAAC,OAAO,QAAQ,EACrF,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,UAAU,kBAAkB;GAAU,CAAC,OAAO,QAAQ;EACpG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Output, c as ResolveNameParams, d as
|
|
1
|
+
import { a as Output, c as ResolveNameParams, d as BaseGenerator, f as Oas, g as contentType, h as SchemaObject, i as Group, m as Operation, n as PluginManager, o as Plugin, p as HttpMethod, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as Logger } from "./index-B8yvSsLX.js";
|
|
2
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
2
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
4
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
5
5
|
|
|
6
6
|
//#region ../plugin-oas/src/types.d.ts
|
|
7
7
|
type Context$2 = {
|
|
@@ -109,6 +109,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
109
109
|
override: Array<Override<TOptions>> | undefined;
|
|
110
110
|
contentType: contentType | undefined;
|
|
111
111
|
pluginManager: PluginManager;
|
|
112
|
+
logger?: Logger;
|
|
112
113
|
/**
|
|
113
114
|
* Current plugin
|
|
114
115
|
*/
|
|
@@ -352,6 +353,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
352
353
|
fabric: Fabric;
|
|
353
354
|
oas: Oas;
|
|
354
355
|
pluginManager: PluginManager;
|
|
356
|
+
logger?: Logger;
|
|
355
357
|
/**
|
|
356
358
|
* Current plugin
|
|
357
359
|
*/
|
|
@@ -508,4 +510,4 @@ type ResolvedOptions = {
|
|
|
508
510
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
509
511
|
//#endregion
|
|
510
512
|
export { PluginMsw as n, ReactGenerator as r, Options as t };
|
|
511
|
-
//# sourceMappingURL=types-
|
|
513
|
+
//# sourceMappingURL=types-BUzgaOhd.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Output, c as ResolveNameParams, d as
|
|
2
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
1
|
+
import { a as Output, c as ResolveNameParams, d as BaseGenerator, f as Oas, g as contentType, h as SchemaObject, i as Group, m as Operation, n as PluginManager, o as Plugin, p as HttpMethod, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as Logger } from "./index-BSYdDKeZ.cjs";
|
|
3
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
5
5
|
|
|
6
6
|
//#region ../plugin-oas/src/types.d.ts
|
|
7
7
|
type Context$2 = {
|
|
@@ -109,6 +109,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
109
109
|
override: Array<Override<TOptions>> | undefined;
|
|
110
110
|
contentType: contentType | undefined;
|
|
111
111
|
pluginManager: PluginManager;
|
|
112
|
+
logger?: Logger;
|
|
112
113
|
/**
|
|
113
114
|
* Current plugin
|
|
114
115
|
*/
|
|
@@ -352,6 +353,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
352
353
|
fabric: Fabric;
|
|
353
354
|
oas: Oas;
|
|
354
355
|
pluginManager: PluginManager;
|
|
356
|
+
logger?: Logger;
|
|
355
357
|
/**
|
|
356
358
|
* Current plugin
|
|
357
359
|
*/
|
|
@@ -508,4 +510,4 @@ type ResolvedOptions = {
|
|
|
508
510
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
509
511
|
//#endregion
|
|
510
512
|
export { PluginMsw as n, ReactGenerator as r, Options as t };
|
|
511
|
-
//# sourceMappingURL=types-
|
|
513
|
+
//# sourceMappingURL=types-MDRyMp8X.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-msw",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.2",
|
|
4
4
|
"description": "Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"msw",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@kubb/react-fabric": "0.5.4",
|
|
77
|
-
"@kubb/core": "4.11.
|
|
78
|
-
"@kubb/oas": "4.11.
|
|
79
|
-
"@kubb/plugin-faker": "4.11.
|
|
80
|
-
"@kubb/plugin-oas": "4.11.
|
|
81
|
-
"@kubb/plugin-ts": "4.11.
|
|
77
|
+
"@kubb/core": "4.11.2",
|
|
78
|
+
"@kubb/oas": "4.11.2",
|
|
79
|
+
"@kubb/plugin-faker": "4.11.2",
|
|
80
|
+
"@kubb/plugin-oas": "4.11.2",
|
|
81
|
+
"@kubb/plugin-ts": "4.11.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {},
|
|
84
84
|
"engines": {
|