@kubb/plugin-mcp 4.10.0 → 4.10.1
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.cjs +0 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +0 -1
- package/dist/{index-CkZlWRRA.d.ts → index-DI8TPGrZ.d.ts} +7 -7
- package/dist/{index-CmN8HkOs.d.cts → index-LobIH03Q.d.cts} +7 -7
- package/dist/index.cjs +0 -1
- 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 +0 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-36g9KUtL.d.ts → types-Du4Y2uo8.d.ts} +2 -2
- package/dist/{types-Rbjb-w6M.d.cts → types-rbWW4ifO.d.cts} +2 -2
- package/package.json +13 -13
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
package/dist/generators.cjs
CHANGED
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ReactGenerator } from "./index-
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
1
|
+
import { n as ReactGenerator } from "./index-LobIH03Q.cjs";
|
|
2
|
+
import { n as PluginMcp } from "./types-rbWW4ifO.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mcpGenerator.d.ts
|
|
5
5
|
declare const mcpGenerator: ReactGenerator<PluginMcp>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ReactGenerator } from "./index-
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
1
|
+
import { n as ReactGenerator } from "./index-DI8TPGrZ.js";
|
|
2
|
+
import { n as PluginMcp } from "./types-Du4Y2uo8.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mcpGenerator.d.ts
|
|
5
5
|
declare const mcpGenerator: ReactGenerator<PluginMcp>;
|
package/dist/generators.js
CHANGED
|
@@ -392,7 +392,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
392
392
|
result: Result;
|
|
393
393
|
plugin: Plugin;
|
|
394
394
|
};
|
|
395
|
-
type Options$
|
|
395
|
+
type Options$1 = {
|
|
396
396
|
fabric: Fabric;
|
|
397
397
|
logger: Logger;
|
|
398
398
|
/**
|
|
@@ -418,8 +418,8 @@ declare class PluginManager {
|
|
|
418
418
|
readonly config: Config;
|
|
419
419
|
readonly executed: Array<Executer>;
|
|
420
420
|
readonly logger: Logger;
|
|
421
|
-
readonly options: Options$
|
|
422
|
-
constructor(config: Config, options: Options$
|
|
421
|
+
readonly options: Options$1;
|
|
422
|
+
constructor(config: Config, options: Options$1);
|
|
423
423
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
424
424
|
get plugins(): Array<Plugin>;
|
|
425
425
|
getFile<TOptions = object>({
|
|
@@ -534,7 +534,7 @@ type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
|
534
534
|
};
|
|
535
535
|
//#endregion
|
|
536
536
|
//#region ../oas/src/Oas.d.ts
|
|
537
|
-
type Options
|
|
537
|
+
type Options = {
|
|
538
538
|
contentType?: contentType;
|
|
539
539
|
discriminator?: 'strict' | 'inherit';
|
|
540
540
|
};
|
|
@@ -548,8 +548,8 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
548
548
|
oas: TOAS | OASDocument | string;
|
|
549
549
|
user?: User;
|
|
550
550
|
});
|
|
551
|
-
setOptions(options: Options
|
|
552
|
-
get options(): Options
|
|
551
|
+
setOptions(options: Options): void;
|
|
552
|
+
get options(): Options;
|
|
553
553
|
get($ref: string): any;
|
|
554
554
|
getKey($ref: string): string | undefined;
|
|
555
555
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -1006,4 +1006,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
export { OperationSchemas as a, Oas as c, Output as d, PluginFactoryOptions as f, Include as i, contentType as l, UserPluginWithLifeCycle as m, ReactGenerator as n, Override as o, ResolveNameParams as p, Exclude$1 as r, ResolvePathOptions as s, Generator as t, Group as u };
|
|
1009
|
-
//# sourceMappingURL=index-
|
|
1009
|
+
//# sourceMappingURL=index-DI8TPGrZ.d.ts.map
|
|
@@ -392,7 +392,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
392
392
|
result: Result;
|
|
393
393
|
plugin: Plugin;
|
|
394
394
|
};
|
|
395
|
-
type Options$
|
|
395
|
+
type Options$1 = {
|
|
396
396
|
fabric: Fabric;
|
|
397
397
|
logger: Logger;
|
|
398
398
|
/**
|
|
@@ -418,8 +418,8 @@ declare class PluginManager {
|
|
|
418
418
|
readonly config: Config;
|
|
419
419
|
readonly executed: Array<Executer>;
|
|
420
420
|
readonly logger: Logger;
|
|
421
|
-
readonly options: Options$
|
|
422
|
-
constructor(config: Config, options: Options$
|
|
421
|
+
readonly options: Options$1;
|
|
422
|
+
constructor(config: Config, options: Options$1);
|
|
423
423
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
424
424
|
get plugins(): Array<Plugin>;
|
|
425
425
|
getFile<TOptions = object>({
|
|
@@ -534,7 +534,7 @@ type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
|
534
534
|
};
|
|
535
535
|
//#endregion
|
|
536
536
|
//#region ../oas/src/Oas.d.ts
|
|
537
|
-
type Options
|
|
537
|
+
type Options = {
|
|
538
538
|
contentType?: contentType;
|
|
539
539
|
discriminator?: 'strict' | 'inherit';
|
|
540
540
|
};
|
|
@@ -548,8 +548,8 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
548
548
|
oas: TOAS | OASDocument | string;
|
|
549
549
|
user?: User;
|
|
550
550
|
});
|
|
551
|
-
setOptions(options: Options
|
|
552
|
-
get options(): Options
|
|
551
|
+
setOptions(options: Options): void;
|
|
552
|
+
get options(): Options;
|
|
553
553
|
get($ref: string): any;
|
|
554
554
|
getKey($ref: string): string | undefined;
|
|
555
555
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -1006,4 +1006,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
export { OperationSchemas as a, Oas as c, Output as d, PluginFactoryOptions as f, Include as i, contentType as l, UserPluginWithLifeCycle as m, ReactGenerator as n, Override as o, ResolveNameParams as p, Exclude$1 as r, ResolvePathOptions as s, Generator as t, Group as u };
|
|
1009
|
-
//# sourceMappingURL=index-
|
|
1009
|
+
//# sourceMappingURL=index-LobIH03Q.d.cts.map
|
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","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'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].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)}Requests`\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 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 const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\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":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","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'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].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)}Requests`\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 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 const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\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":";;;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,O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EvF,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMH,kBAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,kDACE,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAU,gDAAgD,8CACjG,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,kDAA2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,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 { m as UserPluginWithLifeCycle } from "./index-
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { m as UserPluginWithLifeCycle } from "./index-LobIH03Q.cjs";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-rbWW4ifO.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMcpName = "plugin-mcp";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as UserPluginWithLifeCycle } from "./index-
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { m as UserPluginWithLifeCycle } from "./index-DI8TPGrZ.js";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-Du4Y2uo8.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMcpName = "plugin-mcp";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { n as mcpGenerator, t as serverGenerator } from "./generators-CVUEqndF.js";
|
|
2
|
-
import "./Server-CtdIxL1s.js";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
4
|
import { camelCase } from "@kubb/core/transformers";
|
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'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].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)}Requests`\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 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 const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\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":"
|
|
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'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].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)}Requests`\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 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 const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\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":";;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,cAAc,gBAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAAC;GAAe;GAAc;GAAc,CAAC,OAAO,QAAQ;EACjE,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,WAA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K,QAAQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAO,oBAAoB,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,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,4 +1,4 @@
|
|
|
1
|
-
import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-
|
|
1
|
+
import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-DI8TPGrZ.js";
|
|
2
2
|
|
|
3
3
|
//#region ../plugin-client/src/types.d.ts
|
|
4
4
|
|
|
@@ -180,4 +180,4 @@ type ResolvedOptions = {
|
|
|
180
180
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
181
181
|
//#endregion
|
|
182
182
|
export { PluginMcp as n, Options as t };
|
|
183
|
-
//# sourceMappingURL=types-
|
|
183
|
+
//# sourceMappingURL=types-Du4Y2uo8.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-
|
|
1
|
+
import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-LobIH03Q.cjs";
|
|
2
2
|
|
|
3
3
|
//#region ../plugin-client/src/types.d.ts
|
|
4
4
|
|
|
@@ -180,4 +180,4 @@ type ResolvedOptions = {
|
|
|
180
180
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
181
181
|
//#endregion
|
|
182
182
|
export { PluginMcp as n, Options as t };
|
|
183
|
-
//# sourceMappingURL=types-
|
|
183
|
+
//# sourceMappingURL=types-rbWW4ifO.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-mcp",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.1",
|
|
4
4
|
"description": "Generator mcp",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"require": "./dist/index.cjs",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./components": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"require": "./dist/components.cjs",
|
|
31
|
+
"import": "./dist/components.js"
|
|
32
32
|
},
|
|
33
33
|
"./generators": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"require": "./dist/generators.cjs",
|
|
35
|
+
"import": "./dist/generators.js"
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
],
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@kubb/react-fabric": "0.5.4",
|
|
73
|
-
"@kubb/core": "4.10.
|
|
74
|
-
"@kubb/oas": "4.10.
|
|
75
|
-
"@kubb/plugin-client": "4.10.
|
|
76
|
-
"@kubb/plugin-oas": "4.10.
|
|
77
|
-
"@kubb/plugin-ts": "4.10.
|
|
78
|
-
"@kubb/plugin-zod": "4.10.
|
|
73
|
+
"@kubb/core": "4.10.1",
|
|
74
|
+
"@kubb/oas": "4.10.1",
|
|
75
|
+
"@kubb/plugin-client": "4.10.1",
|
|
76
|
+
"@kubb/plugin-oas": "4.10.1",
|
|
77
|
+
"@kubb/plugin-ts": "4.10.1",
|
|
78
|
+
"@kubb/plugin-zod": "4.10.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {},
|
|
81
81
|
"engines": {
|