@kubb/plugin-msw 3.0.0-alpha.7 → 3.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-LXZF3YE3.js → chunk-3KHLTEUD.js} +3 -3
- package/dist/chunk-3KHLTEUD.js.map +1 -0
- package/dist/{chunk-FNHHPVHL.cjs → chunk-BD7UJBXM.cjs} +3 -3
- package/dist/chunk-BD7UJBXM.cjs.map +1 -0
- package/dist/components.cjs +2 -2
- package/dist/components.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.js +1 -1
- package/package.json +13 -13
- package/src/components/Mock.tsx +1 -1
- package/src/components/Operations.tsx +1 -1
- package/dist/chunk-FNHHPVHL.cjs.map +0 -1
- package/dist/chunk-LXZF3YE3.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { pluginFakerName } from "@kubb/plugin-faker";
|
|
|
5
5
|
import { useOperation, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
6
6
|
import { jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
7
7
|
function Template({ name, method, path, responseName }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, children: `
|
|
8
|
+
return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: `
|
|
9
9
|
export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {
|
|
10
10
|
return new Response(JSON.stringify(${responseName}()), {
|
|
11
11
|
headers: {
|
|
@@ -60,7 +60,7 @@ import { useOperationManager as useOperationManager2, useOperations } from "@kub
|
|
|
60
60
|
import { File as File2, useApp as useApp2 } from "@kubb/react";
|
|
61
61
|
import { jsx as jsx2, jsxs as jsxs2 } from "@kubb/react/jsx-runtime";
|
|
62
62
|
function Template2({ name, handlers }) {
|
|
63
|
-
return /* @__PURE__ */ jsx2(File2.Source, { name, isExportable: true, children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const` });
|
|
63
|
+
return /* @__PURE__ */ jsx2(File2.Source, { name, isExportable: true, isIndexable: true, children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const` });
|
|
64
64
|
}
|
|
65
65
|
function RootTemplate({ children }) {
|
|
66
66
|
const {
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
Mock,
|
|
102
102
|
Operations
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-3KHLTEUD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Mock.tsx","../src/components/Operations.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { File, useApp } from '@kubb/react'\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Method of the current operation, see useOperation.\n */\n method: HttpMethod\n /**\n * Path of the mock\n */\n path: URLPath\n /**\n * Name of the import for the mock(this is a function).\n * @example createPet\n */\n responseName: string\n}\n\nfunction Template({ name, method, path, responseName }: TemplateProps): ReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n {`\n export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {\n return new Response(JSON.stringify(${responseName}()), {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n })\n `}\n </File.Source>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Mock({ Template = defaultTemplates.default }: Props): ReactNode {\n const { pluginManager } = useApp<PluginMsw>()\n const { getSchemas, getName } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const name = getName(operation, { type: 'function' })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'type',\n })\n\n return <Template name={name} responseName={responseName} method={operation.method} path={new URLPath(operation.path)} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nMock.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: {\n options: { extName },\n },\n } = useApp<PluginMsw>()\n const { getSchemas, getFile } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const file = getFile(operation)\n const fileFaker = getFile(operation, { pluginKey: [pluginFakerName] })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'function',\n })\n\n const Template = templates.default\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['http']} path={'msw'} />\n {fileFaker && responseName && <File.Import name={[responseName]} root={file.path} path={fileFaker.path} />}\n <Mock Template={Template} />\n </File>\n )\n}\n\nMock.templates = defaultTemplates\n","import { useOperationManager, useOperations } from '@kubb/plugin-oas/hooks'\nimport { File, useApp } from '@kubb/react'\n\nimport type { KubbNode } from '@kubb/react/types'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n handlers: string[]\n}\n\nfunction Template({ name, handlers }: TemplateProps): ReactNode {\n return <File.Source name={name} isExportable isIndexable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}</File.Source>\n}\n\ntype ParserTemplateProps = {\n children?: React.ReactNode\n}\n\nfunction RootTemplate({ children }: ParserTemplateProps) {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const { getName, getFile } = useOperationManager()\n\n const file = pluginManager.getFile({ name: 'handlers', extName: '.ts', pluginKey })\n const operations = useOperations()\n\n const imports = operations\n .map((operation) => {\n const operationFile = getFile(operation, { pluginKey })\n const operationName = getName(operation, { pluginKey, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n .filter(Boolean)\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {imports}\n {children}\n </File>\n )\n}\n\nconst defaultTemplates = { default: Template, root: RootTemplate } as const\n\ntype Templates = Partial<typeof defaultTemplates>\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Operations({ Template = defaultTemplates.default }: Props): ReactNode {\n const {\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const operations = useOperations()\n const { getName } = useOperationManager()\n\n return <Template name=\"handlers\" handlers={operations.map((operation) => getName(operation, { type: 'function', pluginKey }))} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: Templates\n}\n\nOperations.File = function (props: FileProps): KubbNode {\n const templates = { ...defaultTemplates, ...props.templates }\n\n const Template = templates.default\n const RootTemplate = templates.root\n\n return (\n <RootTemplate>\n <Operations Template={Template} />\n </RootTemplate>\n )\n}\n\nOperations.templates = defaultTemplates\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,cAAc;AAC7B,SAAS,uBAAuB;AAChC,SAAS,cAAc,2BAA2B;AA4B9C,cAoEA,YApEA;AAFJ,SAAS,SAAS,EAAE,MAAM,QAAQ,MAAM,aAAa,GAA6B;AAChF,SACE,oBAAC,KAAK,QAAL,EAAY,MAAY,cAAY,MAAC,aAAW,MAC9C;AAAA,iBACU,IAAI,WAAW,MAAM,MAAM,KAAK,UAAU,CAAC;AAAA,yCACnB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAOjD;AAEJ;AAEA,IAAM,mBAAmB,EAAE,SAAS,SAAS;AAStC,SAAS,KAAK,EAAE,UAAAA,YAAW,iBAA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J,QAAQ,EAAE,KAAK,UAAU;AAAA,EAC3B,IAAIJ,QAAkB;AAEtB,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,QAAQ,IAAIF,qBAAoB;AAExC,SAAO,gBAAAG,KAACE,WAAA,EAAS,MAAK,YAAW,UAAU,WAAW,IAAI,CAAC,cAAc,QAAQ,WAAW,EAAE,MAAM,YAAY,UAAU,CAAC,CAAC,GAAG;AACjI;AASA,WAAW,OAAO,SAAU,OAA4B;AACtD,QAAM,YAAY,EAAE,GAAGC,mBAAkB,GAAG,MAAM,UAAU;AAE5D,QAAMD,YAAW,UAAU;AAC3B,QAAME,gBAAe,UAAU;AAE/B,SACE,gBAAAJ,KAACI,eAAA,EACC,0BAAAJ,KAAC,cAAW,UAAUE,WAAU,GAClC;AAEJ;AAEA,WAAW,YAAYC;","names":["Template","useOperationManager","File","useApp","jsx","jsxs","Template","defaultTemplates","RootTemplate"]}
|
|
@@ -5,7 +5,7 @@ var _pluginfaker = require('@kubb/plugin-faker');
|
|
|
5
5
|
var _hooks = require('@kubb/plugin-oas/hooks');
|
|
6
6
|
var _jsxruntime = require('@kubb/react/jsx-runtime');
|
|
7
7
|
function Template({ name, method, path, responseName }) {
|
|
8
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: `
|
|
8
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, isIndexable: true, children: `
|
|
9
9
|
export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {
|
|
10
10
|
return new Response(JSON.stringify(${responseName}()), {
|
|
11
11
|
headers: {
|
|
@@ -60,7 +60,7 @@ Mock.templates = defaultTemplates;
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
function Template2({ name, handlers }) {
|
|
63
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const` });
|
|
63
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, isIndexable: true, children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const` });
|
|
64
64
|
}
|
|
65
65
|
function RootTemplate({ children }) {
|
|
66
66
|
const {
|
|
@@ -101,4 +101,4 @@ Operations.templates = defaultTemplates2;
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
exports.Mock = Mock; exports.Operations = Operations;
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-BD7UJBXM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-msw/dist/chunk-BD7UJBXM.cjs","../src/components/Mock.tsx","../src/components/Operations.tsx"],"names":["Template","jsx","File","useApp","useOperationManager","jsxs","defaultTemplates","RootTemplate"],"mappings":"AAAA;ACAA,yCAAwB;AACxB,oCAA6B;AAC7B,iDAAgC;AAChC,+CAAkD;AA4B9C,qDAAA;AAFJ,SAAS,QAAA,CAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,aAAa,CAAA,EAA6B;AAChF,EAAA,uBACE,6BAAA,WAAC,CAAK,MAAA,EAAL,EAAY,IAAA,EAAY,YAAA,EAAY,IAAA,EAAC,WAAA,EAAW,IAAA,EAC9C,QAAA,EAAA,CAAA;AAAA,eAAA,EACU,IAAI,CAAA,QAAA,EAAW,MAAM,CAAA,GAAA,EAAM,IAAA,CAAK,SAAA,CAAU,CAAC,CAAA;AAAA,uCAAA,EACnB,YAAY,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,EAAA,CAOjD,CAAA;AAEJ;AAEA,IAAM,iBAAA,EAAmB,EAAE,OAAA,EAAS,SAAS,CAAA;AAStC,SAAS,IAAA,CAAK,EAAE,QAAA,EAAAA,UAAAA,EAAW,gBAAA,CAAiB,QAAQ,CAAA,EAAqB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;AAEA,IAAMI,kBAAAA,EAAmB,EAAE,OAAA,EAASN,SAAAA,EAAU,IAAA,EAAM,aAAa,CAAA;AAW1D,SAAS,UAAA,CAAW,EAAE,QAAA,EAAAA,UAAAA,EAAWM,iBAAAA,CAAiB,QAAQ,CAAA,EAAqB;AACpF,EAAA,MAAM;AAAA,IACJ,MAAA,EAAQ,EAAE,GAAA,EAAK,UAAU;AAAA,EAC3B,EAAA,EAAIH,2BAAAA,CAAkB;AAEtB,EAAA,MAAM,WAAA,EAAa,kCAAA,CAAc;AACjC,EAAA,MAAM,EAAE,QAAQ,EAAA,EAAIC,wCAAAA,CAAoB;AAExC,EAAA,uBAAOH,6BAAAA,SAACD,EAAA,EAAS,IAAA,EAAK,UAAA,EAAW,QAAA,EAAU,UAAA,CAAW,GAAA,CAAI,CAAC,SAAA,EAAA,GAAc,OAAA,CAAQ,SAAA,EAAW,EAAE,IAAA,EAAM,UAAA,EAAY,UAAU,CAAC,CAAC,EAAA,CAAG,CAAA;AACjI;AASA,UAAA,CAAW,KAAA,EAAO,QAAA,CAAU,KAAA,EAA4B;AACtD,EAAA,MAAM,UAAA,EAAY,EAAE,GAAGM,iBAAAA,EAAkB,GAAG,KAAA,CAAM,UAAU,CAAA;AAE5D,EAAA,MAAMN,UAAAA,EAAW,SAAA,CAAU,OAAA;AAC3B,EAAA,MAAMO,cAAAA,EAAe,SAAA,CAAU,IAAA;AAE/B,EAAA,uBACEN,6BAAAA,aAACM,EAAA,EACC,QAAA,kBAAAN,6BAAAA,UAAC,EAAA,EAAW,QAAA,EAAUD,UAAAA,CAAU,EAAA,CAClC,CAAA;AAEJ,CAAA;AAEA,UAAA,CAAW,UAAA,EAAYM,iBAAAA;AFKvB;AACA;AACE;AACA;AACF,qDAAC","file":"/home/runner/work/kubb/kubb/packages/plugin-msw/dist/chunk-BD7UJBXM.cjs","sourcesContent":[null,"import { URLPath } from '@kubb/core/utils'\nimport { File, useApp } from '@kubb/react'\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Method of the current operation, see useOperation.\n */\n method: HttpMethod\n /**\n * Path of the mock\n */\n path: URLPath\n /**\n * Name of the import for the mock(this is a function).\n * @example createPet\n */\n responseName: string\n}\n\nfunction Template({ name, method, path, responseName }: TemplateProps): ReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n {`\n export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {\n return new Response(JSON.stringify(${responseName}()), {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n })\n `}\n </File.Source>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Mock({ Template = defaultTemplates.default }: Props): ReactNode {\n const { pluginManager } = useApp<PluginMsw>()\n const { getSchemas, getName } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const name = getName(operation, { type: 'function' })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'type',\n })\n\n return <Template name={name} responseName={responseName} method={operation.method} path={new URLPath(operation.path)} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nMock.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: {\n options: { extName },\n },\n } = useApp<PluginMsw>()\n const { getSchemas, getFile } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const file = getFile(operation)\n const fileFaker = getFile(operation, { pluginKey: [pluginFakerName] })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'function',\n })\n\n const Template = templates.default\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['http']} path={'msw'} />\n {fileFaker && responseName && <File.Import name={[responseName]} root={file.path} path={fileFaker.path} />}\n <Mock Template={Template} />\n </File>\n )\n}\n\nMock.templates = defaultTemplates\n","import { useOperationManager, useOperations } from '@kubb/plugin-oas/hooks'\nimport { File, useApp } from '@kubb/react'\n\nimport type { KubbNode } from '@kubb/react/types'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n handlers: string[]\n}\n\nfunction Template({ name, handlers }: TemplateProps): ReactNode {\n return <File.Source name={name} isExportable isIndexable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}</File.Source>\n}\n\ntype ParserTemplateProps = {\n children?: React.ReactNode\n}\n\nfunction RootTemplate({ children }: ParserTemplateProps) {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const { getName, getFile } = useOperationManager()\n\n const file = pluginManager.getFile({ name: 'handlers', extName: '.ts', pluginKey })\n const operations = useOperations()\n\n const imports = operations\n .map((operation) => {\n const operationFile = getFile(operation, { pluginKey })\n const operationName = getName(operation, { pluginKey, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n .filter(Boolean)\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {imports}\n {children}\n </File>\n )\n}\n\nconst defaultTemplates = { default: Template, root: RootTemplate } as const\n\ntype Templates = Partial<typeof defaultTemplates>\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Operations({ Template = defaultTemplates.default }: Props): ReactNode {\n const {\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const operations = useOperations()\n const { getName } = useOperationManager()\n\n return <Template name=\"handlers\" handlers={operations.map((operation) => getName(operation, { type: 'function', pluginKey }))} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: Templates\n}\n\nOperations.File = function (props: FileProps): KubbNode {\n const templates = { ...defaultTemplates, ...props.templates }\n\n const Template = templates.default\n const RootTemplate = templates.root\n\n return (\n <RootTemplate>\n <Operations Template={Template} />\n </RootTemplate>\n )\n}\n\nOperations.templates = defaultTemplates\n"]}
|
package/dist/components.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkBD7UJBXMcjs = require('./chunk-BD7UJBXM.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.Mock =
|
|
8
|
+
exports.Mock = _chunkBD7UJBXMcjs.Mock; exports.Operations = _chunkBD7UJBXMcjs.Operations;
|
|
9
9
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkBD7UJBXMcjs = require('./chunk-BD7UJBXM.cjs');
|
|
5
5
|
|
|
6
6
|
// src/plugin.ts
|
|
7
7
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -24,12 +24,12 @@ var OperationGenerator = class extends _pluginoas.OperationGenerator {
|
|
|
24
24
|
logger: pluginManager.logger
|
|
25
25
|
});
|
|
26
26
|
const templates = {
|
|
27
|
-
operations:
|
|
28
|
-
mock:
|
|
27
|
+
operations: _chunkBD7UJBXMcjs.Operations.templates,
|
|
28
|
+
mock: _chunkBD7UJBXMcjs.Mock.templates,
|
|
29
29
|
...this.options.templates
|
|
30
30
|
};
|
|
31
31
|
root.render(
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.App, { pluginManager, plugin, mode, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas, { oas, operations, generator: this, children: _optionalChain([templates, 'optionalAccess', _ => _.operations]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
32
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.App, { pluginManager, plugin, mode, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas, { oas, operations, generator: this, children: _optionalChain([templates, 'optionalAccess', _ => _.operations]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBD7UJBXMcjs.Operations.File, { templates: templates.operations }) }) })
|
|
33
33
|
);
|
|
34
34
|
return root.files;
|
|
35
35
|
}
|
|
@@ -39,15 +39,15 @@ var OperationGenerator = class extends _pluginoas.OperationGenerator {
|
|
|
39
39
|
logger: pluginManager.logger
|
|
40
40
|
});
|
|
41
41
|
const templates = {
|
|
42
|
-
handlers:
|
|
43
|
-
mock:
|
|
42
|
+
handlers: _chunkBD7UJBXMcjs.Operations.templates,
|
|
43
|
+
mock: _chunkBD7UJBXMcjs.Mock.templates,
|
|
44
44
|
...options.templates
|
|
45
45
|
};
|
|
46
46
|
if (!_optionalChain([templates, 'optionalAccess', _2 => _2.mock])) {
|
|
47
47
|
return [];
|
|
48
48
|
}
|
|
49
49
|
root.render(
|
|
50
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas.Operation, { operation, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
50
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Oas.Operation, { operation, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBD7UJBXMcjs.Mock.File, { templates: templates.mock }) }) }) })
|
|
51
51
|
);
|
|
52
52
|
return root.files;
|
|
53
53
|
}
|
|
@@ -67,8 +67,8 @@ var pluginMsw = _core.createPlugin.call(void 0, (options) => {
|
|
|
67
67
|
options: {
|
|
68
68
|
extName: output.extName,
|
|
69
69
|
templates: {
|
|
70
|
-
operations:
|
|
71
|
-
mock:
|
|
70
|
+
operations: _chunkBD7UJBXMcjs.Operations.templates,
|
|
71
|
+
mock: _chunkBD7UJBXMcjs.Mock.templates,
|
|
72
72
|
...templates
|
|
73
73
|
}
|
|
74
74
|
},
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-msw",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.8",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"!/**/__tests__/**"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@kubb/core": "3.0.0-alpha.
|
|
70
|
-
"@kubb/fs": "3.0.0-alpha.
|
|
71
|
-
"@kubb/oas": "3.0.0-alpha.
|
|
72
|
-
"@kubb/parser-ts": "3.0.0-alpha.
|
|
73
|
-
"@kubb/plugin-faker": "3.0.0-alpha.
|
|
74
|
-
"@kubb/plugin-oas": "3.0.0-alpha.
|
|
75
|
-
"@kubb/plugin-ts": "3.0.0-alpha.
|
|
76
|
-
"@kubb/react": "3.0.0-alpha.
|
|
69
|
+
"@kubb/core": "3.0.0-alpha.8",
|
|
70
|
+
"@kubb/fs": "3.0.0-alpha.8",
|
|
71
|
+
"@kubb/oas": "3.0.0-alpha.8",
|
|
72
|
+
"@kubb/parser-ts": "3.0.0-alpha.8",
|
|
73
|
+
"@kubb/plugin-faker": "3.0.0-alpha.8",
|
|
74
|
+
"@kubb/plugin-oas": "3.0.0-alpha.8",
|
|
75
|
+
"@kubb/plugin-ts": "3.0.0-alpha.8",
|
|
76
|
+
"@kubb/react": "3.0.0-alpha.8"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/react": "^18.3.4",
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"react": "^18.3.1",
|
|
82
82
|
"tsup": "^8.2.4",
|
|
83
83
|
"typescript": "^5.5.4",
|
|
84
|
-
"@kubb/config-biome": "3.0.0-alpha.
|
|
85
|
-
"@kubb/config-ts": "3.0.0-alpha.
|
|
86
|
-
"@kubb/config-tsup": "3.0.0-alpha.
|
|
84
|
+
"@kubb/config-biome": "3.0.0-alpha.8",
|
|
85
|
+
"@kubb/config-ts": "3.0.0-alpha.8",
|
|
86
|
+
"@kubb/config-tsup": "3.0.0-alpha.8"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@kubb/react": "3.0.0-alpha.
|
|
89
|
+
"@kubb/react": "3.0.0-alpha.8"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
92
|
"node": ">=20"
|
package/src/components/Mock.tsx
CHANGED
|
@@ -29,7 +29,7 @@ type TemplateProps = {
|
|
|
29
29
|
|
|
30
30
|
function Template({ name, method, path, responseName }: TemplateProps): ReactNode {
|
|
31
31
|
return (
|
|
32
|
-
<File.Source name={name} isExportable>
|
|
32
|
+
<File.Source name={name} isExportable isIndexable>
|
|
33
33
|
{`
|
|
34
34
|
export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {
|
|
35
35
|
return new Response(JSON.stringify(${responseName}()), {
|
|
@@ -14,7 +14,7 @@ type TemplateProps = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function Template({ name, handlers }: TemplateProps): ReactNode {
|
|
17
|
-
return <File.Source name={name} isExportable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, '')} as const`}</File.Source>
|
|
17
|
+
return <File.Source name={name} isExportable isIndexable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, '')} as const`}</File.Source>
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
type ParserTemplateProps = {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-msw/dist/chunk-FNHHPVHL.cjs","../src/components/Mock.tsx","../src/components/Operations.tsx"],"names":["Template","jsx","File","useApp","useOperationManager","jsxs","defaultTemplates","RootTemplate"],"mappings":"AAAA;ACAA,yCAAwB;AACxB,oCAA6B;AAC7B,iDAAgC;AAChC,+CAAkD;AA4B9C,qDAAA;AAFJ,SAAS,QAAA,CAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,aAAa,CAAA,EAA6B;AAChF,EAAA,uBACE,6BAAA,WAAC,CAAK,MAAA,EAAL,EAAY,IAAA,EAAY,YAAA,EAAY,IAAA,EAClC,QAAA,EAAA,CAAA;AAAA,eAAA,EACU,IAAI,CAAA,QAAA,EAAW,MAAM,CAAA,GAAA,EAAM,IAAA,CAAK,SAAA,CAAU,CAAC,CA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,CAAA;AAEA,UAAA,CAAW,UAAA,EAAYM,iBAAAA;AFKvB;AACA;AACE;AACA;AACF,qDAAC","file":"/home/runner/work/kubb/kubb/packages/plugin-msw/dist/chunk-FNHHPVHL.cjs","sourcesContent":[null,"import { URLPath } from '@kubb/core/utils'\nimport { File, useApp } from '@kubb/react'\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Method of the current operation, see useOperation.\n */\n method: HttpMethod\n /**\n * Path of the mock\n */\n path: URLPath\n /**\n * Name of the import for the mock(this is a function).\n * @example createPet\n */\n responseName: string\n}\n\nfunction Template({ name, method, path, responseName }: TemplateProps): ReactNode {\n return (\n <File.Source name={name} isExportable>\n {`\n export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {\n return new Response(JSON.stringify(${responseName}()), {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n })\n `}\n </File.Source>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Mock({ Template = defaultTemplates.default }: Props): ReactNode {\n const { pluginManager } = useApp<PluginMsw>()\n const { getSchemas, getName } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const name = getName(operation, { type: 'function' })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'type',\n })\n\n return <Template name={name} responseName={responseName} method={operation.method} path={new URLPath(operation.path)} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nMock.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: {\n options: { extName },\n },\n } = useApp<PluginMsw>()\n const { getSchemas, getFile } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const file = getFile(operation)\n const fileFaker = getFile(operation, { pluginKey: [pluginFakerName] })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'function',\n })\n\n const Template = templates.default\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['http']} path={'msw'} />\n {fileFaker && responseName && <File.Import name={[responseName]} root={file.path} path={fileFaker.path} />}\n <Mock Template={Template} />\n </File>\n )\n}\n\nMock.templates = defaultTemplates\n","import { useOperationManager, useOperations } from '@kubb/plugin-oas/hooks'\nimport { File, useApp } from '@kubb/react'\n\nimport type { KubbNode } from '@kubb/react/types'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n handlers: string[]\n}\n\nfunction Template({ name, handlers }: TemplateProps): ReactNode {\n return <File.Source name={name} isExportable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}</File.Source>\n}\n\ntype ParserTemplateProps = {\n children?: React.ReactNode\n}\n\nfunction RootTemplate({ children }: ParserTemplateProps) {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const { getName, getFile } = useOperationManager()\n\n const file = pluginManager.getFile({ name: 'handlers', extName: '.ts', pluginKey })\n const operations = useOperations()\n\n const imports = operations\n .map((operation) => {\n const operationFile = getFile(operation, { pluginKey })\n const operationName = getName(operation, { pluginKey, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n .filter(Boolean)\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {imports}\n {children}\n </File>\n )\n}\n\nconst defaultTemplates = { default: Template, root: RootTemplate } as const\n\ntype Templates = Partial<typeof defaultTemplates>\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Operations({ Template = defaultTemplates.default }: Props): ReactNode {\n const {\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const operations = useOperations()\n const { getName } = useOperationManager()\n\n return <Template name=\"handlers\" handlers={operations.map((operation) => getName(operation, { type: 'function', pluginKey }))} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: Templates\n}\n\nOperations.File = function (props: FileProps): KubbNode {\n const templates = { ...defaultTemplates, ...props.templates }\n\n const Template = templates.default\n const RootTemplate = templates.root\n\n return (\n <RootTemplate>\n <Operations Template={Template} />\n </RootTemplate>\n )\n}\n\nOperations.templates = defaultTemplates\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Mock.tsx","../src/components/Operations.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { File, useApp } from '@kubb/react'\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\n\nimport type { HttpMethod } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n /**\n * Method of the current operation, see useOperation.\n */\n method: HttpMethod\n /**\n * Path of the mock\n */\n path: URLPath\n /**\n * Name of the import for the mock(this is a function).\n * @example createPet\n */\n responseName: string\n}\n\nfunction Template({ name, method, path, responseName }: TemplateProps): ReactNode {\n return (\n <File.Source name={name} isExportable>\n {`\n export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {\n return new Response(JSON.stringify(${responseName}()), {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n })\n `}\n </File.Source>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Mock({ Template = defaultTemplates.default }: Props): ReactNode {\n const { pluginManager } = useApp<PluginMsw>()\n const { getSchemas, getName } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const name = getName(operation, { type: 'function' })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'type',\n })\n\n return <Template name={name} responseName={responseName} method={operation.method} path={new URLPath(operation.path)} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nMock.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: {\n options: { extName },\n },\n } = useApp<PluginMsw>()\n const { getSchemas, getFile } = useOperationManager()\n const operation = useOperation()\n\n const schemas = getSchemas(operation)\n const file = getFile(operation)\n const fileFaker = getFile(operation, { pluginKey: [pluginFakerName] })\n const responseName = pluginManager.resolveName({\n pluginKey: [pluginFakerName],\n name: schemas.response.name,\n type: 'function',\n })\n\n const Template = templates.default\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['http']} path={'msw'} />\n {fileFaker && responseName && <File.Import name={[responseName]} root={file.path} path={fileFaker.path} />}\n <Mock Template={Template} />\n </File>\n )\n}\n\nMock.templates = defaultTemplates\n","import { useOperationManager, useOperations } from '@kubb/plugin-oas/hooks'\nimport { File, useApp } from '@kubb/react'\n\nimport type { KubbNode } from '@kubb/react/types'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginMsw } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n handlers: string[]\n}\n\nfunction Template({ name, handlers }: TemplateProps): ReactNode {\n return <File.Source name={name} isExportable>{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}</File.Source>\n}\n\ntype ParserTemplateProps = {\n children?: React.ReactNode\n}\n\nfunction RootTemplate({ children }: ParserTemplateProps) {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const { getName, getFile } = useOperationManager()\n\n const file = pluginManager.getFile({ name: 'handlers', extName: '.ts', pluginKey })\n const operations = useOperations()\n\n const imports = operations\n .map((operation) => {\n const operationFile = getFile(operation, { pluginKey })\n const operationName = getName(operation, { pluginKey, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n .filter(Boolean)\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {imports}\n {children}\n </File>\n )\n}\n\nconst defaultTemplates = { default: Template, root: RootTemplate } as const\n\ntype Templates = Partial<typeof defaultTemplates>\n\ntype Props = {\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function Operations({ Template = defaultTemplates.default }: Props): ReactNode {\n const {\n plugin: { key: pluginKey },\n } = useApp<PluginMsw>()\n\n const operations = useOperations()\n const { getName } = useOperationManager()\n\n return <Template name=\"handlers\" handlers={operations.map((operation) => getName(operation, { type: 'function', pluginKey }))} />\n}\n\ntype FileProps = {\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: Templates\n}\n\nOperations.File = function (props: FileProps): KubbNode {\n const templates = { ...defaultTemplates, ...props.templates }\n\n const Template = templates.default\n const RootTemplate = templates.root\n\n return (\n <RootTemplate>\n <Operations Template={Template} />\n </RootTemplate>\n )\n}\n\nOperations.templates = defaultTemplates\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,cAAc;AAC7B,SAAS,uBAAuB;AAChC,SAAS,cAAc,2BAA2B;AA4B9C,cAoEA,YApEA;AAFJ,SAAS,SAAS,EAAE,MAAM,QAAQ,MAAM,aAAa,GAA6B;AAChF,SACE,oBAAC,KAAK,QAAL,EAAY,MAAY,cAAY,MAClC;AAAA,iBACU,IAAI,WAAW,MAAM,MAAM,KAA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