@kubb/plugin-msw 5.0.0-beta.81 → 5.0.0-beta.85
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 +72 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -18
- package/dist/index.js +47 -82
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
package/dist/index.cjs
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#endregion
|
|
6
|
-
let
|
|
6
|
+
let kubb_kit = require("kubb/kit");
|
|
7
7
|
let _kubb_plugin_faker = require("@kubb/plugin-faker");
|
|
8
8
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
9
|
-
let
|
|
10
|
-
let
|
|
9
|
+
let kubb_jsx = require("kubb/jsx");
|
|
10
|
+
let kubb_jsx_jsx_runtime = require("kubb/jsx/jsx-runtime");
|
|
11
11
|
//#region ../../internals/utils/src/casing.ts
|
|
12
12
|
/**
|
|
13
13
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -35,31 +35,6 @@ function camelCase(text, { prefix = "", suffix = "" } = {}) {
|
|
|
35
35
|
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
|
-
//#region ../../internals/utils/src/fs.ts
|
|
39
|
-
/**
|
|
40
|
-
* Builds a nested file path from a dotted name. Splits on dots that precede a letter
|
|
41
|
-
* (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
|
|
42
|
-
* every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
|
|
43
|
-
*
|
|
44
|
-
* Empty segments are dropped before joining. They arise when the name starts with a dot
|
|
45
|
-
* followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
|
|
46
|
-
* an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
|
|
47
|
-
* absolute path, letting generated files escape the configured output directory.
|
|
48
|
-
*
|
|
49
|
-
* @example Nested path from a dotted name
|
|
50
|
-
* `toFilePath('pet.petId') // 'pet/petId'`
|
|
51
|
-
*
|
|
52
|
-
* @example PascalCase the final segment
|
|
53
|
-
* `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
|
|
54
|
-
*
|
|
55
|
-
* @example Suffix applied to the final segment only
|
|
56
|
-
* `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
|
|
57
|
-
*/
|
|
58
|
-
function toFilePath(name, caseLast = camelCase) {
|
|
59
|
-
const parts = name.split(/\.(?=[a-zA-Z])/);
|
|
60
|
-
return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : camelCase(part)).filter(Boolean).join("/");
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
38
|
//#region ../../internals/utils/src/reserved.ts
|
|
64
39
|
/**
|
|
65
40
|
* JavaScript and Java reserved words.
|
|
@@ -296,12 +271,12 @@ function resolveResponseTypes(node, resolver) {
|
|
|
296
271
|
const types = [];
|
|
297
272
|
for (const response of node.responses) {
|
|
298
273
|
if (response.statusCode === "default") {
|
|
299
|
-
types.push(["default", resolver.
|
|
274
|
+
types.push(["default", resolver.response.response(node)]);
|
|
300
275
|
continue;
|
|
301
276
|
}
|
|
302
277
|
const code = getStatusCodeNumber(response.statusCode);
|
|
303
278
|
if (code === null) continue;
|
|
304
|
-
types.push([code, isSuccessStatusCode(code) ? resolver.
|
|
279
|
+
types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)]);
|
|
305
280
|
}
|
|
306
281
|
return types;
|
|
307
282
|
}
|
|
@@ -340,48 +315,46 @@ function createGroupConfig(group) {
|
|
|
340
315
|
//#region src/generators/handlersGenerator.ts
|
|
341
316
|
/**
|
|
342
317
|
* Aggregate generator enabled by `pluginMsw({ handlers: true })`. Emits a
|
|
343
|
-
* `handlers.ts` file that re-exports every generated handler
|
|
344
|
-
*
|
|
318
|
+
* `handlers.ts` file that re-exports every generated handler in operation
|
|
319
|
+
* order, ready to spread into `setupServer(...handlers)` or
|
|
345
320
|
* `setupWorker(...handlers)`.
|
|
346
321
|
*/
|
|
347
|
-
const handlersGenerator = (0,
|
|
322
|
+
const handlersGenerator = (0, kubb_kit.defineGenerator)({
|
|
348
323
|
name: "plugin-msw",
|
|
349
324
|
operations(nodes, ctx) {
|
|
350
325
|
const { resolver, config, root } = ctx;
|
|
351
326
|
const { output, group } = ctx.options;
|
|
352
|
-
const handlersName = resolver.
|
|
353
|
-
const file = resolver.
|
|
354
|
-
name:
|
|
355
|
-
extname: ".ts"
|
|
356
|
-
}, {
|
|
327
|
+
const handlersName = resolver.handler.listName();
|
|
328
|
+
const file = resolver.file({
|
|
329
|
+
name: handlersName,
|
|
330
|
+
extname: ".ts",
|
|
357
331
|
root,
|
|
358
332
|
output,
|
|
359
333
|
group: group ?? void 0
|
|
360
334
|
});
|
|
361
335
|
const imports = nodes.map((node) => {
|
|
362
|
-
const operationName = resolver.
|
|
363
|
-
const operationFile = resolver.
|
|
364
|
-
name: resolver.
|
|
336
|
+
const operationName = resolver.handler.name(node);
|
|
337
|
+
const operationFile = resolver.file({
|
|
338
|
+
name: resolver.name(node.operationId),
|
|
365
339
|
extname: ".ts",
|
|
366
340
|
tag: node.tags[0] ?? "default",
|
|
367
|
-
path: node.path
|
|
368
|
-
}, {
|
|
341
|
+
path: node.path,
|
|
369
342
|
root,
|
|
370
343
|
output,
|
|
371
344
|
group: group ?? void 0
|
|
372
345
|
});
|
|
373
|
-
return
|
|
346
|
+
return kubb_kit.ast.factory.createImport({
|
|
374
347
|
name: [operationName],
|
|
375
348
|
root: file.path,
|
|
376
349
|
path: operationFile.path
|
|
377
350
|
});
|
|
378
351
|
});
|
|
379
|
-
const handlers = nodes.map((node) => `${resolver.
|
|
380
|
-
return [
|
|
352
|
+
const handlers = nodes.map((node) => `${resolver.handler.name(node)}()`);
|
|
353
|
+
return [kubb_kit.ast.factory.createFile({
|
|
381
354
|
baseName: file.baseName,
|
|
382
355
|
path: file.path,
|
|
383
356
|
meta: file.meta,
|
|
384
|
-
banner: resolver.
|
|
357
|
+
banner: resolver.default.banner(ctx.meta, {
|
|
385
358
|
output,
|
|
386
359
|
config,
|
|
387
360
|
file: {
|
|
@@ -389,7 +362,7 @@ const handlersGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
389
362
|
baseName: file.baseName
|
|
390
363
|
}
|
|
391
364
|
}),
|
|
392
|
-
footer: resolver.
|
|
365
|
+
footer: resolver.default.footer(ctx.meta, {
|
|
393
366
|
output,
|
|
394
367
|
config,
|
|
395
368
|
file: {
|
|
@@ -398,11 +371,11 @@ const handlersGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
398
371
|
}
|
|
399
372
|
}),
|
|
400
373
|
imports,
|
|
401
|
-
sources: [
|
|
374
|
+
sources: [kubb_kit.ast.factory.createSource({
|
|
402
375
|
name: handlersName,
|
|
403
376
|
isIndexable: true,
|
|
404
377
|
isExportable: true,
|
|
405
|
-
nodes: [
|
|
378
|
+
nodes: [kubb_kit.ast.factory.createText(`export const ${handlersName} = ${JSON.stringify(handlers).replaceAll("\"", "")} as const`)]
|
|
406
379
|
})]
|
|
407
380
|
})];
|
|
408
381
|
}
|
|
@@ -439,13 +412,13 @@ function getResponseContentType(response) {
|
|
|
439
412
|
* Converts an HTTP method to its lowercase MSW equivalent (e.g., 'POST' → 'post').
|
|
440
413
|
*/
|
|
441
414
|
function getMswMethod(node) {
|
|
442
|
-
return
|
|
415
|
+
return kubb_kit.ast.isHttpOperationNode(node) ? node.method.toLowerCase() : "";
|
|
443
416
|
}
|
|
444
417
|
/**
|
|
445
418
|
* Converts an OpenAPI-style path to an Express/MSW-style path by replacing `{param}` with `:param`.
|
|
446
419
|
*/
|
|
447
420
|
function getMswUrl(node) {
|
|
448
|
-
return
|
|
421
|
+
return kubb_kit.ast.isHttpOperationNode(node) ? node.path.replaceAll("{", ":").replaceAll("}", "") : "";
|
|
449
422
|
}
|
|
450
423
|
/**
|
|
451
424
|
* Resolves faker metadata for an MSW operation, including response name and file path.
|
|
@@ -454,13 +427,12 @@ function resolveFakerMeta(node, options) {
|
|
|
454
427
|
const { root, fakerResolver, fakerOutput, fakerGroup } = options;
|
|
455
428
|
const tag = node.tags[0] ?? "default";
|
|
456
429
|
return {
|
|
457
|
-
name: fakerResolver.
|
|
458
|
-
file: fakerResolver.
|
|
430
|
+
name: fakerResolver.response.response(node),
|
|
431
|
+
file: fakerResolver.file({
|
|
459
432
|
name: node.operationId,
|
|
460
433
|
extname: ".ts",
|
|
461
434
|
tag,
|
|
462
|
-
path: node.path
|
|
463
|
-
}, {
|
|
435
|
+
path: node.path,
|
|
464
436
|
root,
|
|
465
437
|
output: fakerOutput,
|
|
466
438
|
group: fakerGroup ?? void 0
|
|
@@ -485,11 +457,11 @@ function Mock({ baseURL = "", name, typeName, requestTypeName, node }) {
|
|
|
485
457
|
optional: true
|
|
486
458
|
})] }));
|
|
487
459
|
const httpCall = requestTypeName ? `http.${method}<Record<string, string>, ${requestTypeName}>` : `http.${method}`;
|
|
488
|
-
return /* @__PURE__ */ (0,
|
|
460
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
489
461
|
name,
|
|
490
462
|
isIndexable: true,
|
|
491
463
|
isExportable: true,
|
|
492
|
-
children: /* @__PURE__ */ (0,
|
|
464
|
+
children: /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.Function, {
|
|
493
465
|
name,
|
|
494
466
|
export: true,
|
|
495
467
|
params: params ?? "",
|
|
@@ -523,11 +495,11 @@ function MockWithFaker({ baseURL = "", name, fakerName, typeName, requestTypeNam
|
|
|
523
495
|
optional: true
|
|
524
496
|
})] }));
|
|
525
497
|
const httpCall = requestTypeName ? `http.${method}<Record<string, string>, ${requestTypeName}>` : `http.${method}`;
|
|
526
|
-
return /* @__PURE__ */ (0,
|
|
498
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
527
499
|
name,
|
|
528
500
|
isIndexable: true,
|
|
529
501
|
isExportable: true,
|
|
530
|
-
children: /* @__PURE__ */ (0,
|
|
502
|
+
children: /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.Function, {
|
|
531
503
|
name,
|
|
532
504
|
export: true,
|
|
533
505
|
params: params ?? "",
|
|
@@ -557,11 +529,11 @@ function Response({ name, typeName, response }) {
|
|
|
557
529
|
optional: !hasResponseSchema(response)
|
|
558
530
|
})] }));
|
|
559
531
|
const responseName = `${name}Response${statusCode}`;
|
|
560
|
-
return /* @__PURE__ */ (0,
|
|
532
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
561
533
|
name: responseName,
|
|
562
534
|
isIndexable: true,
|
|
563
535
|
isExportable: true,
|
|
564
|
-
children: /* @__PURE__ */ (0,
|
|
536
|
+
children: /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.Function, {
|
|
565
537
|
name: responseName,
|
|
566
538
|
export: true,
|
|
567
539
|
params: params ?? "",
|
|
@@ -583,22 +555,21 @@ function Response({ name, typeName, response }) {
|
|
|
583
555
|
* from `@kubb/plugin-faker`; with `parser: 'data'` it returns a typed empty
|
|
584
556
|
* payload for tests to fill in.
|
|
585
557
|
*/
|
|
586
|
-
const mswGenerator = (0,
|
|
558
|
+
const mswGenerator = (0, kubb_kit.defineGenerator)({
|
|
587
559
|
name: "msw",
|
|
588
|
-
renderer:
|
|
560
|
+
renderer: kubb_jsx.jsxRenderer,
|
|
589
561
|
operation(node, ctx) {
|
|
590
|
-
if (!
|
|
562
|
+
if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
|
|
591
563
|
const { driver, resolver, config, root } = ctx;
|
|
592
564
|
const { output, parser, baseURL, group } = ctx.options;
|
|
593
|
-
const fileName = resolver.
|
|
565
|
+
const fileName = resolver.name(node.operationId);
|
|
594
566
|
const mock = {
|
|
595
|
-
name: resolver.
|
|
596
|
-
file: resolver.
|
|
567
|
+
name: resolver.handler.name(node),
|
|
568
|
+
file: resolver.file({
|
|
597
569
|
name: fileName,
|
|
598
570
|
extname: ".ts",
|
|
599
571
|
tag: node.tags[0] ?? "default",
|
|
600
|
-
path: node.path
|
|
601
|
-
}, {
|
|
572
|
+
path: node.path,
|
|
602
573
|
root,
|
|
603
574
|
output,
|
|
604
575
|
group: group ?? void 0
|
|
@@ -615,26 +586,25 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
615
586
|
if (!pluginTs) return null;
|
|
616
587
|
const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
|
|
617
588
|
const type = {
|
|
618
|
-
file: tsResolver.
|
|
589
|
+
file: tsResolver.file({
|
|
619
590
|
name: node.operationId,
|
|
620
591
|
extname: ".ts",
|
|
621
592
|
tag: node.tags[0] ?? "default",
|
|
622
|
-
path: node.path
|
|
623
|
-
}, {
|
|
593
|
+
path: node.path,
|
|
624
594
|
root,
|
|
625
595
|
output: pluginTs.options?.output ?? output,
|
|
626
596
|
group: pluginTs.options?.group ?? void 0
|
|
627
597
|
}),
|
|
628
|
-
responseName: tsResolver.
|
|
598
|
+
responseName: tsResolver.response.response(node)
|
|
629
599
|
};
|
|
630
600
|
const types = resolveResponseTypes(node, tsResolver);
|
|
631
601
|
const hasSuccessSchema = getOperationSuccessResponses(node).some((response) => !!response.content?.[0]?.schema);
|
|
632
|
-
const requestName = node.requestBody?.content?.[0]?.schema ? tsResolver.
|
|
633
|
-
return /* @__PURE__ */ (0,
|
|
602
|
+
const requestName = node.requestBody?.content?.[0]?.schema ? tsResolver.response.body(node) : null;
|
|
603
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsxs)(kubb_jsx.File, {
|
|
634
604
|
baseName: mock.file.baseName,
|
|
635
605
|
path: mock.file.path,
|
|
636
606
|
meta: mock.file.meta,
|
|
637
|
-
banner: resolver.
|
|
607
|
+
banner: resolver.default.banner(ctx.meta, {
|
|
638
608
|
output,
|
|
639
609
|
config,
|
|
640
610
|
file: {
|
|
@@ -642,7 +612,7 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
642
612
|
baseName: mock.file.baseName
|
|
643
613
|
}
|
|
644
614
|
}),
|
|
645
|
-
footer: resolver.
|
|
615
|
+
footer: resolver.default.footer(ctx.meta, {
|
|
646
616
|
output,
|
|
647
617
|
config,
|
|
648
618
|
file: {
|
|
@@ -651,16 +621,16 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
651
621
|
}
|
|
652
622
|
}),
|
|
653
623
|
children: [
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
624
|
+
/* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Import, {
|
|
655
625
|
name: ["http"],
|
|
656
626
|
path: "msw"
|
|
657
627
|
}),
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
628
|
+
/* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Import, {
|
|
659
629
|
name: ["HttpResponseResolver"],
|
|
660
630
|
isTypeOnly: true,
|
|
661
631
|
path: "msw"
|
|
662
632
|
}),
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
633
|
+
/* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Import, {
|
|
664
634
|
name: Array.from(/* @__PURE__ */ new Set([
|
|
665
635
|
type.responseName,
|
|
666
636
|
...types.map((t) => t[1]),
|
|
@@ -670,7 +640,7 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
670
640
|
root: mock.file.path,
|
|
671
641
|
isTypeOnly: true
|
|
672
642
|
}),
|
|
673
|
-
parser === "faker" && faker && /* @__PURE__ */ (0,
|
|
643
|
+
parser === "faker" && faker && /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Import, {
|
|
674
644
|
name: [faker.name],
|
|
675
645
|
root: mock.file.path,
|
|
676
646
|
path: faker.file.path
|
|
@@ -678,20 +648,20 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
678
648
|
types.filter(([code]) => code !== "default").map(([code, typeName]) => {
|
|
679
649
|
const response = node.responses.find((item) => item.statusCode === String(code));
|
|
680
650
|
if (!response) return null;
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
651
|
+
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(Response, {
|
|
682
652
|
typeName,
|
|
683
653
|
response,
|
|
684
654
|
name: mock.name
|
|
685
655
|
}, typeName);
|
|
686
656
|
}),
|
|
687
|
-
parser === "faker" && faker && hasSuccessSchema ? /* @__PURE__ */ (0,
|
|
657
|
+
parser === "faker" && faker && hasSuccessSchema ? /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(MockWithFaker, {
|
|
688
658
|
name: mock.name,
|
|
689
659
|
typeName: type.responseName,
|
|
690
660
|
requestTypeName: requestName,
|
|
691
661
|
fakerName: faker.name,
|
|
692
662
|
node,
|
|
693
663
|
baseURL
|
|
694
|
-
}) : /* @__PURE__ */ (0,
|
|
664
|
+
}) : /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(Mock, {
|
|
695
665
|
name: mock.name,
|
|
696
666
|
typeName: type.responseName,
|
|
697
667
|
requestTypeName: requestName,
|
|
@@ -709,32 +679,30 @@ const mswGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
709
679
|
* paths for every generated MSW handler. Function names get a `Handler`
|
|
710
680
|
* suffix; the aggregate export is always `handlers`.
|
|
711
681
|
*
|
|
682
|
+
* The top-level `name` applies the `handler` suffix, and `file` falls back to the built-in
|
|
683
|
+
* `toFilePath` casing. Operation-specific naming is grouped under the `handler` namespace.
|
|
684
|
+
*
|
|
712
685
|
* @example Resolve a handler name
|
|
713
686
|
* ```ts
|
|
714
687
|
* import { resolverMsw } from '@kubb/plugin-msw'
|
|
715
688
|
*
|
|
716
|
-
* resolverMsw.
|
|
689
|
+
* resolverMsw.name('addPet') // 'addPetHandler'
|
|
717
690
|
* ```
|
|
718
691
|
*/
|
|
719
|
-
const resolverMsw = (0,
|
|
720
|
-
name: "default",
|
|
692
|
+
const resolverMsw = (0, kubb_kit.createResolver)({
|
|
721
693
|
pluginName: "plugin-msw",
|
|
722
|
-
|
|
723
|
-
return type === "file" ? toFilePath(name) : camelCase(name);
|
|
724
|
-
},
|
|
725
|
-
resolveName(name) {
|
|
694
|
+
name(name) {
|
|
726
695
|
return camelCase(name, { suffix: "handler" });
|
|
727
696
|
},
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
return "handlers";
|
|
697
|
+
handler: {
|
|
698
|
+
name(node) {
|
|
699
|
+
return this.name(node.operationId);
|
|
700
|
+
},
|
|
701
|
+
listName() {
|
|
702
|
+
return "handlers";
|
|
703
|
+
}
|
|
736
704
|
}
|
|
737
|
-
})
|
|
705
|
+
});
|
|
738
706
|
//#endregion
|
|
739
707
|
//#region src/plugin.ts
|
|
740
708
|
/**
|
|
@@ -751,7 +719,7 @@ const pluginMswName = "plugin-msw";
|
|
|
751
719
|
*
|
|
752
720
|
* @example
|
|
753
721
|
* ```ts
|
|
754
|
-
* import { defineConfig } from 'kubb'
|
|
722
|
+
* import { defineConfig } from 'kubb/config'
|
|
755
723
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
756
724
|
* import { pluginMsw } from '@kubb/plugin-msw'
|
|
757
725
|
*
|
|
@@ -768,7 +736,7 @@ const pluginMswName = "plugin-msw";
|
|
|
768
736
|
* })
|
|
769
737
|
* ```
|
|
770
738
|
*/
|
|
771
|
-
const pluginMsw = (0,
|
|
739
|
+
const pluginMsw = (0, kubb_kit.definePlugin)((options) => {
|
|
772
740
|
const { output = {
|
|
773
741
|
path: "handlers",
|
|
774
742
|
barrel: { type: "named" }
|
|
@@ -779,10 +747,7 @@ const pluginMsw = (0, _kubb_core.definePlugin)((options) => {
|
|
|
779
747
|
options,
|
|
780
748
|
dependencies: [_kubb_plugin_ts.pluginTsName, parser === "faker" ? _kubb_plugin_faker.pluginFakerName : null].filter((dependency) => Boolean(dependency)),
|
|
781
749
|
hooks: { "kubb:plugin:setup"(ctx) {
|
|
782
|
-
const resolver = userResolver ?
|
|
783
|
-
...resolverMsw,
|
|
784
|
-
...userResolver
|
|
785
|
-
} : resolverMsw;
|
|
750
|
+
const resolver = userResolver ? kubb_kit.Resolver.merge(resolverMsw, userResolver) : resolverMsw;
|
|
786
751
|
ctx.setOptions({
|
|
787
752
|
output,
|
|
788
753
|
parser,
|