@kubb/plugin-cypress 4.11.3 → 4.12.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.
Files changed (32) hide show
  1. package/dist/{components-DYt2ZP4C.cjs → components-B0qj_LXl.cjs} +2 -2
  2. package/dist/{components-DYt2ZP4C.cjs.map → components-B0qj_LXl.cjs.map} +1 -1
  3. package/dist/{components-B-dUAGQo.js → components-GZOhGVCA.js} +2 -2
  4. package/dist/{components-B-dUAGQo.js.map → components-GZOhGVCA.js.map} +1 -1
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +1 -1
  7. package/dist/components.d.ts +1 -1
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-BQycxSP1.js → generators-CnEpcL-m.js} +2 -2
  10. package/dist/{generators-BQycxSP1.js.map → generators-CnEpcL-m.js.map} +1 -1
  11. package/dist/{generators-DHCx8qS9.cjs → generators-CvL7yszV.cjs} +2 -2
  12. package/dist/{generators-DHCx8qS9.cjs.map → generators-CvL7yszV.cjs.map} +1 -1
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +3 -4
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +3 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-Cu2aEsbs.d.ts → types-BVMff21d.d.ts} +215 -102
  24. package/dist/{types-DosRH6oz.d.cts → types-DjLyok_a.d.cts} +215 -102
  25. package/package.json +6 -6
  26. package/src/components/Request.tsx +1 -1
  27. package/src/generators/__snapshots__/createPet.ts +1 -1
  28. package/src/generators/__snapshots__/deletePet.ts +1 -1
  29. package/src/generators/__snapshots__/getPets.ts +1 -1
  30. package/src/generators/__snapshots__/getPetsWithTemplateString.ts +15 -0
  31. package/src/generators/__snapshots__/showPetById.ts +1 -1
  32. package/src/plugin.ts +1 -2
@@ -30,7 +30,7 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method
30
30
  returnType,
31
31
  children: [dataReturnType === "data" && `return cy.request({
32
32
  method: '${method}',
33
- url: '${baseURL ?? ""}${new __kubb_core_utils.URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}',
33
+ url: \`${baseURL ?? ""}${new __kubb_core_utils.URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}\`,
34
34
  body: ${body},
35
35
  ...options,
36
36
  }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`, dataReturnType === "full" && `return cy.request('${method}', '${new __kubb_core_utils.URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`]
@@ -45,4 +45,4 @@ Object.defineProperty(exports, 'Request', {
45
45
  return Request;
46
46
  }
47
47
  });
48
- //# sourceMappingURL=components-DYt2ZP4C.cjs.map
48
+ //# sourceMappingURL=components-B0qj_LXl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-DYt2ZP4C.cjs","names":["FunctionParams","File","Function","URLPath"],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data' &&\n `return cy.request({\n method: '${method}', \n url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAASA,mCAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,qCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAY;YACnC,0DAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;oBACV,WAAW,KAAK,IAAIC,0BAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC5E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAIA,0BAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
1
+ {"version":3,"file":"components-B0qj_LXl.cjs","names":["FunctionParams","File","Function","URLPath"],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data' &&\n `return cy.request({\n method: '${method}', \n url: \\`${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}\\`, \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAASA,mCAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,qCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAY;YACnC,0DAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;qBACT,WAAW,KAAK,IAAIC,0BAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC7E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAIA,0BAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
@@ -29,7 +29,7 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method
29
29
  returnType,
30
30
  children: [dataReturnType === "data" && `return cy.request({
31
31
  method: '${method}',
32
- url: '${baseURL ?? ""}${new URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}',
32
+ url: \`${baseURL ?? ""}${new URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}\`,
33
33
  body: ${body},
34
34
  ...options,
35
35
  }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`, dataReturnType === "full" && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`]
@@ -39,4 +39,4 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method
39
39
 
40
40
  //#endregion
41
41
  export { Request as t };
42
- //# sourceMappingURL=components-B-dUAGQo.js.map
42
+ //# sourceMappingURL=components-GZOhGVCA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-B-dUAGQo.js","names":[],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data' &&\n `return cy.request({\n method: '${method}', \n url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAAS,eAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,qBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;oBACV,WAAW,KAAK,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC5E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAI,QAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
1
+ {"version":3,"file":"components-GZOhGVCA.js","names":[],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data' &&\n `return cy.request({\n method: '${method}', \n url: \\`${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}\\`, \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAAS,eAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,qBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;qBACT,WAAW,KAAK,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC7E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAI,QAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
@@ -1,3 +1,3 @@
1
- const require_components = require('./components-DYt2ZP4C.cjs');
1
+ const require_components = require('./components-B0qj_LXl.cjs');
2
2
 
3
3
  exports.Request = require_components.Request;
@@ -1,4 +1,4 @@
1
- import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DosRH6oz.cjs";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DjLyok_a.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Request.d.ts
@@ -1,4 +1,4 @@
1
- import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-Cu2aEsbs.js";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-BVMff21d.js";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Request.d.ts
@@ -1,3 +1,3 @@
1
- import { t as Request } from "./components-B-dUAGQo.js";
1
+ import { t as Request } from "./components-GZOhGVCA.js";
2
2
 
3
3
  export { Request };
@@ -1,4 +1,4 @@
1
- import { t as Request } from "./components-B-dUAGQo.js";
1
+ import { t as Request } from "./components-GZOhGVCA.js";
2
2
  import { pluginTsName } from "@kubb/plugin-ts";
3
3
  import { usePluginManager } from "@kubb/core/hooks";
4
4
  import { URLPath } from "@kubb/core/utils";
@@ -66,4 +66,4 @@ const cypressGenerator = createReactGenerator({
66
66
 
67
67
  //#endregion
68
68
  export { cypressGenerator as t };
69
- //# sourceMappingURL=generators-BQycxSP1.js.map
69
+ //# sourceMappingURL=generators-CnEpcL-m.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-BQycxSP1.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;cAElC,oBAAC,KAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,oBAAC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
1
+ {"version":3,"file":"generators-CnEpcL-m.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;cAElC,oBAAC,KAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,oBAAC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-DYt2ZP4C.cjs');
1
+ const require_components = require('./components-B0qj_LXl.cjs');
2
2
  const require_index = require('./index.cjs');
3
3
  let __kubb_plugin_ts = require("@kubb/plugin-ts");
4
4
  let __kubb_core_hooks = require("@kubb/core/hooks");
@@ -72,4 +72,4 @@ Object.defineProperty(exports, 'cypressGenerator', {
72
72
  return cypressGenerator;
73
73
  }
74
74
  });
75
- //# sourceMappingURL=generators-DHCx8qS9.cjs.map
75
+ //# sourceMappingURL=generators-CvL7yszV.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-DHCx8qS9.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,0EAAuD;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,0DAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,yDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
1
+ {"version":3,"file":"generators-CvL7yszV.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,0EAAuD;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,0DAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,yDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
@@ -1,3 +1,3 @@
1
- const require_generators = require('./generators-DHCx8qS9.cjs');
1
+ const require_generators = require('./generators-CvL7yszV.cjs');
2
2
 
3
3
  exports.cypressGenerator = require_generators.cypressGenerator;
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, r as ReactGenerator } from "./types-DosRH6oz.cjs";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-DjLyok_a.cjs";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, r as ReactGenerator } from "./types-Cu2aEsbs.js";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-BVMff21d.js";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,3 +1,3 @@
1
- import { t as cypressGenerator } from "./generators-BQycxSP1.js";
1
+ import { t as cypressGenerator } from "./generators-CnEpcL-m.js";
2
2
 
3
3
  export { cypressGenerator };
package/dist/index.cjs CHANGED
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_generators = require('./generators-DHCx8qS9.cjs');
28
+ const require_generators = require('./generators-CvL7yszV.cjs');
29
29
  let node_path = require("node:path");
30
30
  node_path = __toESM(node_path);
31
31
  let __kubb_core = require("@kubb/core");
@@ -79,7 +79,7 @@ const pluginCypress = (0, __kubb_core.definePlugin)((options) => {
79
79
  fabric: this.fabric,
80
80
  oas,
81
81
  pluginManager: this.pluginManager,
82
- logger: this.logger,
82
+ events: this.events,
83
83
  plugin: this.plugin,
84
84
  contentType,
85
85
  exclude,
@@ -92,8 +92,7 @@ const pluginCypress = (0, __kubb_core.definePlugin)((options) => {
92
92
  type: output.barrelType ?? "named",
93
93
  root,
94
94
  output,
95
- meta: { pluginKey: this.plugin.key },
96
- logger: this.logger
95
+ meta: { pluginKey: this.plugin.key }
97
96
  });
98
97
  await this.upsertFile(...barrelFiles);
99
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["cypressGenerator","pluginOasName","pluginTsName","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'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators'\nimport type { PluginCypress } from './types.ts'\n\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\nexport const pluginCypress = definePlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrelType: 'named' },\n group,\n dataReturnType = 'data',\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [cypressGenerator].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName].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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,+CAA6C,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iBAAiB,QACjB,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,oCAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAACC,iCAAeC,8BAAa,CAAC,OAAO,QAAQ;EAClD,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,EACnC,QAAQ,SAAS,QAClB,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"}
1
+ {"version":3,"file":"index.cjs","names":["cypressGenerator","pluginOasName","pluginTsName","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'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators'\nimport type { PluginCypress } from './types.ts'\n\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\nexport const pluginCypress = definePlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrelType: 'named' },\n group,\n dataReturnType = 'data',\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [cypressGenerator].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName].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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\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 })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,+CAA6C,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iBAAiB,QACjB,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,oCAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAACC,iCAAeC,8BAAa,CAAC,OAAO,QAAQ;EAClD,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,EACnC,QAAQ,SAAS,QAClB,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;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DosRH6oz.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DjLyok_a.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-Cu2aEsbs.js";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-BVMff21d.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as cypressGenerator } from "./generators-BQycxSP1.js";
1
+ import { t as cypressGenerator } from "./generators-CnEpcL-m.js";
2
2
  import path from "node:path";
3
3
  import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
4
4
  import { camelCase } from "@kubb/core/transformers";
@@ -51,7 +51,7 @@ const pluginCypress = definePlugin((options) => {
51
51
  fabric: this.fabric,
52
52
  oas,
53
53
  pluginManager: this.pluginManager,
54
- logger: this.logger,
54
+ events: this.events,
55
55
  plugin: this.plugin,
56
56
  contentType,
57
57
  exclude,
@@ -64,8 +64,7 @@ const pluginCypress = definePlugin((options) => {
64
64
  type: output.barrelType ?? "named",
65
65
  root,
66
66
  output,
67
- meta: { pluginKey: this.plugin.key },
68
- logger: this.logger
67
+ meta: { pluginKey: this.plugin.key }
69
68
  });
70
69
  await this.upsertFile(...barrelFiles);
71
70
  }
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 { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators'\nimport type { PluginCypress } from './types.ts'\n\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\nexport const pluginCypress = definePlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrelType: 'named' },\n group,\n dataReturnType = 'data',\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [cypressGenerator].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName].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\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":";;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,gBAAgB,cAA6B,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iBAAiB,QACjB,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,iBAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,aAAa,CAAC,OAAO,QAAQ;EAClD,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,EACnC,QAAQ,SAAS,QAClB,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
+ {"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 { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators'\nimport type { PluginCypress } from './types.ts'\n\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\nexport const pluginCypress = definePlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrelType: 'named' },\n group,\n dataReturnType = 'data',\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [cypressGenerator].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName].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\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\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 })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,gBAAgB,cAA6B,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iBAAiB,QACjB,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,iBAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,aAAa,CAAC,OAAO,QAAQ;EAClD,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,EACnC,QAAQ,SAAS,QAClB,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;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
@@ -6,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
6
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
7
  import BaseOas from "oas";
8
8
  import { KubbFile } from "@kubb/fabric-core/types";
9
- import { ConsolaInstance, LogLevel } from "consola";
10
9
  import { KubbNode } from "@kubb/react-fabric/types";
11
10
 
12
11
  //#region ../oas/src/types.d.ts
@@ -58,75 +57,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
58
57
  abstract build(...params: unknown[]): unknown;
59
58
  }
60
59
  //#endregion
61
- //#region ../core/src/utils/EventEmitter.d.ts
62
- declare class EventEmitter<TEvents extends Record<string, any>> {
63
- #private;
64
- constructor();
65
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
66
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
67
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
68
- removeAll(): void;
69
- }
70
- //#endregion
71
- //#region ../core/src/logger.d.ts
60
+ //#region ../core/src/Kubb.d.ts
72
61
  type DebugEvent = {
73
62
  date: Date;
74
63
  logs: string[];
75
64
  fileName?: string;
65
+ };
66
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
67
+ hookName: H;
68
+ plugins: Array<Plugin>;
69
+ };
70
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
71
+ hookName: H;
72
+ };
73
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
74
+ strategy: Strategy;
75
+ hookName: H;
76
+ plugin: Plugin;
77
+ parameters?: unknown[] | undefined;
78
+ output?: unknown;
79
+ };
80
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
81
+ duration: number;
82
+ strategy: Strategy;
83
+ hookName: H;
84
+ plugin: Plugin;
85
+ parameters?: unknown[] | undefined;
86
+ output?: unknown;
87
+ };
88
+ /**
89
+ * Events emitted during the Kubb code generation lifecycle.
90
+ * These events can be listened to for logging, progress tracking, and custom integrations.
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * import type { AsyncEventEmitter } from '@kubb/core'
95
+ * import type { KubbEvents } from '@kubb/core'
96
+ *
97
+ * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
98
+ *
99
+ * events.on('lifecycle:start', () => {
100
+ * console.log('Starting Kubb generation')
101
+ * })
102
+ *
103
+ * events.on('plugin:end', (plugin, duration) => {
104
+ * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
105
+ * })
106
+ * ```
107
+ */
108
+ interface KubbEvents {
76
109
  /**
77
- * Category of the debug log, used for GitHub Actions grouping
78
- * - 'setup': Initial configuration and environment setup
79
- * - 'plugin': Plugin installation and execution
80
- * - 'hook': Plugin hook execution details
81
- * - 'schema': Schema parsing and generation
82
- * - 'file': File operations (read/write/generate)
83
- * - 'error': Error details and stack traces
84
- * - undefined: Generic logs (always inline)
110
+ * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
85
111
  */
86
- category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
112
+ 'lifecycle:start': [version: string];
87
113
  /**
88
- * Plugin name for grouping plugin-specific logs together
114
+ * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
89
115
  */
90
- pluginName?: string;
116
+ 'lifecycle:end': [];
91
117
  /**
92
- * Indicates if this is the start or end of a plugin's execution
93
- * - 'start': Start of plugin execution group
94
- * - 'end': End of plugin execution group
118
+ * Emitted when configuration loading starts.
95
119
  */
96
- pluginGroupMarker?: 'start' | 'end';
97
- };
98
- type Events$1 = {
99
- start: [message: string];
100
- success: [message: string];
101
- error: [message: string, error: Error];
102
- warning: [message: string];
103
- debug: [DebugEvent];
104
- verbose: [DebugEvent];
105
- info: [message: string];
106
- progress_start: [{
107
- id: string;
108
- size: number;
109
- message?: string;
110
- }];
111
- progressed: [{
112
- id: string;
113
- message?: string;
120
+ 'config:start': [];
121
+ /**
122
+ * Emitted when configuration loading is complete.
123
+ */
124
+ 'config:end': [configs: Array<Config>];
125
+ /**
126
+ * Emitted when code generation phase starts.
127
+ */
128
+ 'generation:start': [config: Config];
129
+ /**
130
+ * Emitted when code generation phase completes.
131
+ */
132
+ 'generation:end': [Config: Config];
133
+ /**
134
+ * Emitted with a summary of the generation results.
135
+ * Contains summary lines, title, and success status.
136
+ */
137
+ 'generation:summary': [Config: Config, {
138
+ failedPlugins: Set<{
139
+ plugin: Plugin;
140
+ error: Error;
141
+ }>;
142
+ status: 'success' | 'failed';
143
+ hrStart: [number, number];
144
+ filesCreated: number;
145
+ pluginTimings?: Map<string, number>;
114
146
  }];
115
- progress_stop: [{
116
- id: string;
147
+ /**
148
+ * Emitted when code formatting starts (e.g., running Biome or Prettier).
149
+ */
150
+ 'format:start': [];
151
+ /**
152
+ * Emitted when code formatting completes.
153
+ */
154
+ 'format:end': [];
155
+ /**
156
+ * Emitted when linting starts.
157
+ */
158
+ 'lint:start': [];
159
+ /**
160
+ * Emitted when linting completes.
161
+ */
162
+ 'lint:end': [];
163
+ /**
164
+ * Emitted when plugin hooks execution starts.
165
+ */
166
+ 'hooks:start': [];
167
+ /**
168
+ * Emitted when plugin hooks execution completes.
169
+ */
170
+ 'hooks:end': [];
171
+ /**
172
+ * Emitted when a single hook execution starts.
173
+ */
174
+ 'hook:start': [command: string];
175
+ /**
176
+ * Emitted to execute a hook command (e.g., format or lint).
177
+ * The callback should be invoked when the command completes.
178
+ */
179
+ 'hook:execute': [{
180
+ command: string | URL;
181
+ args?: readonly string[];
182
+ }, cb: () => void];
183
+ /**
184
+ * Emitted when a single hook execution completes.
185
+ */
186
+ 'hook:end': [command: string];
187
+ /**
188
+ * Emitted when a new version of Kubb is available.
189
+ */
190
+ 'version:new': [currentVersion: string, latestVersion: string];
191
+ /**
192
+ * Informational message event.
193
+ */
194
+ info: [message: string, info?: string];
195
+ /**
196
+ * Error event. Emitted when an error occurs during code generation.
197
+ */
198
+ error: [error: Error, meta?: Record<string, unknown>];
199
+ /**
200
+ * Success message event.
201
+ */
202
+ success: [message: string, info?: string];
203
+ /**
204
+ * Warning message event.
205
+ */
206
+ warn: [message: string, info?: string];
207
+ /**
208
+ * Debug event for detailed logging.
209
+ * Contains timestamp, log messages, and optional filename.
210
+ */
211
+ debug: [meta: DebugEvent];
212
+ /**
213
+ * Emitted when file processing starts.
214
+ * Contains the list of files to be processed.
215
+ */
216
+ 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
217
+ /**
218
+ * Emitted for each file being processed, providing progress updates.
219
+ * Contains processed count, total count, percentage, and file details.
220
+ */
221
+ 'file:processing:update': [{
222
+ /** Number of files processed so far */
223
+ processed: number;
224
+ /** Total number of files to process */
225
+ total: number;
226
+ /** Processing percentage (0-100) */
227
+ percentage: number;
228
+ /** Optional source identifier */
229
+ source?: string;
230
+ /** The file being processed */
231
+ file: KubbFile.ResolvedFile;
232
+ /**
233
+ * Kubb configuration (not present in Fabric).
234
+ * Provides access to the current config during file processing.
235
+ */
236
+ config: Config;
117
237
  }];
118
- };
119
- type Logger = {
120
238
  /**
121
- * Optional config name to show in CLI output
239
+ * Emitted when file processing completes.
240
+ * Contains the list of processed files.
122
241
  */
123
- name?: string;
124
- logLevel: LogLevel;
125
- consola?: ConsolaInstance;
126
- on: EventEmitter<Events$1>['on'];
127
- emit: EventEmitter<Events$1>['emit'];
128
- writeLogs: () => Promise<void>;
129
- };
242
+ 'files:processing:end': [files: KubbFile.ResolvedFile[]];
243
+ /**
244
+ * Emitted when a plugin starts executing.
245
+ */
246
+ 'plugin:start': [plugin: Plugin];
247
+ /**
248
+ * Emitted when a plugin completes execution.
249
+ */
250
+ 'plugin:end': [plugin: Plugin, duration: number];
251
+ /**
252
+ * Emitted when plugin hook progress tracking starts.
253
+ * Contains the hook name and list of plugins to execute.
254
+ */
255
+ 'plugins:hook:progress:start': [meta: ProgressStartMeta];
256
+ /**
257
+ * Emitted when plugin hook progress tracking ends.
258
+ * Contains the hook name that completed.
259
+ */
260
+ 'plugins:hook:progress:end': [meta: ProgressStopMeta];
261
+ /**
262
+ * Emitted when a plugin hook starts processing.
263
+ * Contains strategy, hook name, plugin, parameters, and output.
264
+ */
265
+ 'plugins:hook:processing:start': [meta: ExecutingMeta];
266
+ /**
267
+ * Emitted when a plugin hook completes processing.
268
+ * Contains duration, strategy, hook name, plugin, parameters, and output.
269
+ */
270
+ 'plugins:hook:processing:end': [meta: ExecutedMeta];
271
+ }
272
+ //#endregion
273
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
274
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
275
+ #private;
276
+ constructor(maxListener?: number);
277
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
278
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
279
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
280
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
281
+ removeAll(): void;
282
+ }
130
283
  //#endregion
131
284
  //#region ../core/src/utils/types.d.ts
132
285
  type PossiblePromise<T> = Promise<T> | T;
@@ -390,7 +543,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
390
543
  * merging multiple sources into the same output file
391
544
  */
392
545
  upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
393
- logger: Logger;
546
+ events: AsyncEventEmitter<KubbEvents>;
394
547
  mode: KubbFile.Mode;
395
548
  /**
396
549
  * Current plugin
@@ -436,35 +589,6 @@ type Group = {
436
589
  //#region ../core/src/PluginManager.d.ts
437
590
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
438
591
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
439
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
440
- strategy: Strategy;
441
- hookName: H;
442
- plugin: Plugin;
443
- parameters?: unknown[] | undefined;
444
- output?: unknown;
445
- };
446
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
447
- duration: number;
448
- strategy: Strategy;
449
- hookName: H;
450
- plugin: Plugin;
451
- parameters?: unknown[] | undefined;
452
- output?: unknown;
453
- };
454
- type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
455
- hookName: H;
456
- duration: number;
457
- strategy: Strategy;
458
- parameters?: unknown[] | undefined;
459
- plugin: Plugin;
460
- };
461
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
- hookName: H;
463
- plugins: Array<Plugin>;
464
- };
465
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
466
- hookName: H;
467
- };
468
592
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
469
593
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
470
594
  result: Result;
@@ -472,19 +596,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
472
596
  };
473
597
  type Options$1 = {
474
598
  fabric: Fabric;
475
- logger: Logger;
599
+ events: AsyncEventEmitter<KubbEvents>;
476
600
  /**
477
601
  * @default Number.POSITIVE_INFINITY
478
602
  */
479
603
  concurrency?: number;
480
604
  };
481
- type Events = {
482
- progress_start: [meta: ProgressStartMeta];
483
- progress_stop: [meta: ProgressStopMeta];
484
- executing: [meta: ExecutingMeta];
485
- executed: [meta: ExecutedMeta];
486
- error: [error: Error, meta: ErrorMeta];
487
- };
488
605
  type GetFileProps<TOptions = object> = {
489
606
  name: string;
490
607
  mode?: KubbFile.Mode;
@@ -494,10 +611,10 @@ type GetFileProps<TOptions = object> = {
494
611
  };
495
612
  declare class PluginManager {
496
613
  #private;
497
- readonly events: EventEmitter<Events>;
498
614
  readonly config: Config;
499
615
  readonly options: Options$1;
500
616
  constructor(config: Config, options: Options$1);
617
+ get events(): AsyncEventEmitter<KubbEvents>;
501
618
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
502
619
  get plugins(): Array<Plugin>;
503
620
  getFile<TOptions = object>({
@@ -511,10 +628,6 @@ declare class PluginManager {
511
628
  }>;
512
629
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
513
630
  resolveName: (params: ResolveNameParams) => string;
514
- /**
515
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
516
- */
517
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
518
631
  /**
519
632
  * Run a specific hookName for plugin x.
520
633
  */
@@ -698,7 +811,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
698
811
  override: Array<Override<TOptions>> | undefined;
699
812
  contentType: contentType | undefined;
700
813
  pluginManager: PluginManager;
701
- logger?: Logger;
814
+ events?: AsyncEventEmitter<KubbEvents>;
702
815
  /**
703
816
  * Current plugin
704
817
  */
@@ -942,7 +1055,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
1055
  fabric: Fabric;
943
1056
  oas: Oas;
944
1057
  pluginManager: PluginManager;
945
- logger?: Logger;
1058
+ events?: AsyncEventEmitter<KubbEvents>;
946
1059
  /**
947
1060
  * Current plugin
948
1061
  */
@@ -1094,4 +1207,4 @@ type ResolvedOptions = {
1094
1207
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
1095
1208
  //#endregion
1096
1209
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options as t };
1097
- //# sourceMappingURL=types-Cu2aEsbs.d.ts.map
1210
+ //# sourceMappingURL=types-BVMff21d.d.ts.map
@@ -6,7 +6,6 @@ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
7
7
  import { KubbFile } from "@kubb/fabric-core/types";
8
8
  import { Fabric } from "@kubb/react-fabric";
9
- import { ConsolaInstance, LogLevel } from "consola";
10
9
  import { KubbNode } from "@kubb/react-fabric/types";
11
10
 
12
11
  //#region ../oas/src/types.d.ts
@@ -58,75 +57,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
58
57
  abstract build(...params: unknown[]): unknown;
59
58
  }
60
59
  //#endregion
61
- //#region ../core/src/utils/EventEmitter.d.ts
62
- declare class EventEmitter<TEvents extends Record<string, any>> {
63
- #private;
64
- constructor();
65
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
66
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
67
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
68
- removeAll(): void;
69
- }
70
- //#endregion
71
- //#region ../core/src/logger.d.ts
60
+ //#region ../core/src/Kubb.d.ts
72
61
  type DebugEvent = {
73
62
  date: Date;
74
63
  logs: string[];
75
64
  fileName?: string;
65
+ };
66
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
67
+ hookName: H;
68
+ plugins: Array<Plugin>;
69
+ };
70
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
71
+ hookName: H;
72
+ };
73
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
74
+ strategy: Strategy;
75
+ hookName: H;
76
+ plugin: Plugin;
77
+ parameters?: unknown[] | undefined;
78
+ output?: unknown;
79
+ };
80
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
81
+ duration: number;
82
+ strategy: Strategy;
83
+ hookName: H;
84
+ plugin: Plugin;
85
+ parameters?: unknown[] | undefined;
86
+ output?: unknown;
87
+ };
88
+ /**
89
+ * Events emitted during the Kubb code generation lifecycle.
90
+ * These events can be listened to for logging, progress tracking, and custom integrations.
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * import type { AsyncEventEmitter } from '@kubb/core'
95
+ * import type { KubbEvents } from '@kubb/core'
96
+ *
97
+ * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
98
+ *
99
+ * events.on('lifecycle:start', () => {
100
+ * console.log('Starting Kubb generation')
101
+ * })
102
+ *
103
+ * events.on('plugin:end', (plugin, duration) => {
104
+ * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
105
+ * })
106
+ * ```
107
+ */
108
+ interface KubbEvents {
76
109
  /**
77
- * Category of the debug log, used for GitHub Actions grouping
78
- * - 'setup': Initial configuration and environment setup
79
- * - 'plugin': Plugin installation and execution
80
- * - 'hook': Plugin hook execution details
81
- * - 'schema': Schema parsing and generation
82
- * - 'file': File operations (read/write/generate)
83
- * - 'error': Error details and stack traces
84
- * - undefined: Generic logs (always inline)
110
+ * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
85
111
  */
86
- category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
112
+ 'lifecycle:start': [version: string];
87
113
  /**
88
- * Plugin name for grouping plugin-specific logs together
114
+ * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
89
115
  */
90
- pluginName?: string;
116
+ 'lifecycle:end': [];
91
117
  /**
92
- * Indicates if this is the start or end of a plugin's execution
93
- * - 'start': Start of plugin execution group
94
- * - 'end': End of plugin execution group
118
+ * Emitted when configuration loading starts.
95
119
  */
96
- pluginGroupMarker?: 'start' | 'end';
97
- };
98
- type Events$1 = {
99
- start: [message: string];
100
- success: [message: string];
101
- error: [message: string, error: Error];
102
- warning: [message: string];
103
- debug: [DebugEvent];
104
- verbose: [DebugEvent];
105
- info: [message: string];
106
- progress_start: [{
107
- id: string;
108
- size: number;
109
- message?: string;
110
- }];
111
- progressed: [{
112
- id: string;
113
- message?: string;
120
+ 'config:start': [];
121
+ /**
122
+ * Emitted when configuration loading is complete.
123
+ */
124
+ 'config:end': [configs: Array<Config>];
125
+ /**
126
+ * Emitted when code generation phase starts.
127
+ */
128
+ 'generation:start': [config: Config];
129
+ /**
130
+ * Emitted when code generation phase completes.
131
+ */
132
+ 'generation:end': [Config: Config];
133
+ /**
134
+ * Emitted with a summary of the generation results.
135
+ * Contains summary lines, title, and success status.
136
+ */
137
+ 'generation:summary': [Config: Config, {
138
+ failedPlugins: Set<{
139
+ plugin: Plugin;
140
+ error: Error;
141
+ }>;
142
+ status: 'success' | 'failed';
143
+ hrStart: [number, number];
144
+ filesCreated: number;
145
+ pluginTimings?: Map<string, number>;
114
146
  }];
115
- progress_stop: [{
116
- id: string;
147
+ /**
148
+ * Emitted when code formatting starts (e.g., running Biome or Prettier).
149
+ */
150
+ 'format:start': [];
151
+ /**
152
+ * Emitted when code formatting completes.
153
+ */
154
+ 'format:end': [];
155
+ /**
156
+ * Emitted when linting starts.
157
+ */
158
+ 'lint:start': [];
159
+ /**
160
+ * Emitted when linting completes.
161
+ */
162
+ 'lint:end': [];
163
+ /**
164
+ * Emitted when plugin hooks execution starts.
165
+ */
166
+ 'hooks:start': [];
167
+ /**
168
+ * Emitted when plugin hooks execution completes.
169
+ */
170
+ 'hooks:end': [];
171
+ /**
172
+ * Emitted when a single hook execution starts.
173
+ */
174
+ 'hook:start': [command: string];
175
+ /**
176
+ * Emitted to execute a hook command (e.g., format or lint).
177
+ * The callback should be invoked when the command completes.
178
+ */
179
+ 'hook:execute': [{
180
+ command: string | URL;
181
+ args?: readonly string[];
182
+ }, cb: () => void];
183
+ /**
184
+ * Emitted when a single hook execution completes.
185
+ */
186
+ 'hook:end': [command: string];
187
+ /**
188
+ * Emitted when a new version of Kubb is available.
189
+ */
190
+ 'version:new': [currentVersion: string, latestVersion: string];
191
+ /**
192
+ * Informational message event.
193
+ */
194
+ info: [message: string, info?: string];
195
+ /**
196
+ * Error event. Emitted when an error occurs during code generation.
197
+ */
198
+ error: [error: Error, meta?: Record<string, unknown>];
199
+ /**
200
+ * Success message event.
201
+ */
202
+ success: [message: string, info?: string];
203
+ /**
204
+ * Warning message event.
205
+ */
206
+ warn: [message: string, info?: string];
207
+ /**
208
+ * Debug event for detailed logging.
209
+ * Contains timestamp, log messages, and optional filename.
210
+ */
211
+ debug: [meta: DebugEvent];
212
+ /**
213
+ * Emitted when file processing starts.
214
+ * Contains the list of files to be processed.
215
+ */
216
+ 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
217
+ /**
218
+ * Emitted for each file being processed, providing progress updates.
219
+ * Contains processed count, total count, percentage, and file details.
220
+ */
221
+ 'file:processing:update': [{
222
+ /** Number of files processed so far */
223
+ processed: number;
224
+ /** Total number of files to process */
225
+ total: number;
226
+ /** Processing percentage (0-100) */
227
+ percentage: number;
228
+ /** Optional source identifier */
229
+ source?: string;
230
+ /** The file being processed */
231
+ file: KubbFile.ResolvedFile;
232
+ /**
233
+ * Kubb configuration (not present in Fabric).
234
+ * Provides access to the current config during file processing.
235
+ */
236
+ config: Config;
117
237
  }];
118
- };
119
- type Logger = {
120
238
  /**
121
- * Optional config name to show in CLI output
239
+ * Emitted when file processing completes.
240
+ * Contains the list of processed files.
122
241
  */
123
- name?: string;
124
- logLevel: LogLevel;
125
- consola?: ConsolaInstance;
126
- on: EventEmitter<Events$1>['on'];
127
- emit: EventEmitter<Events$1>['emit'];
128
- writeLogs: () => Promise<void>;
129
- };
242
+ 'files:processing:end': [files: KubbFile.ResolvedFile[]];
243
+ /**
244
+ * Emitted when a plugin starts executing.
245
+ */
246
+ 'plugin:start': [plugin: Plugin];
247
+ /**
248
+ * Emitted when a plugin completes execution.
249
+ */
250
+ 'plugin:end': [plugin: Plugin, duration: number];
251
+ /**
252
+ * Emitted when plugin hook progress tracking starts.
253
+ * Contains the hook name and list of plugins to execute.
254
+ */
255
+ 'plugins:hook:progress:start': [meta: ProgressStartMeta];
256
+ /**
257
+ * Emitted when plugin hook progress tracking ends.
258
+ * Contains the hook name that completed.
259
+ */
260
+ 'plugins:hook:progress:end': [meta: ProgressStopMeta];
261
+ /**
262
+ * Emitted when a plugin hook starts processing.
263
+ * Contains strategy, hook name, plugin, parameters, and output.
264
+ */
265
+ 'plugins:hook:processing:start': [meta: ExecutingMeta];
266
+ /**
267
+ * Emitted when a plugin hook completes processing.
268
+ * Contains duration, strategy, hook name, plugin, parameters, and output.
269
+ */
270
+ 'plugins:hook:processing:end': [meta: ExecutedMeta];
271
+ }
272
+ //#endregion
273
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
274
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
275
+ #private;
276
+ constructor(maxListener?: number);
277
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
278
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
279
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
280
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
281
+ removeAll(): void;
282
+ }
130
283
  //#endregion
131
284
  //#region ../core/src/utils/types.d.ts
132
285
  type PossiblePromise<T> = Promise<T> | T;
@@ -390,7 +543,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
390
543
  * merging multiple sources into the same output file
391
544
  */
392
545
  upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
393
- logger: Logger;
546
+ events: AsyncEventEmitter<KubbEvents>;
394
547
  mode: KubbFile.Mode;
395
548
  /**
396
549
  * Current plugin
@@ -436,35 +589,6 @@ type Group = {
436
589
  //#region ../core/src/PluginManager.d.ts
437
590
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
438
591
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
439
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
440
- strategy: Strategy;
441
- hookName: H;
442
- plugin: Plugin;
443
- parameters?: unknown[] | undefined;
444
- output?: unknown;
445
- };
446
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
447
- duration: number;
448
- strategy: Strategy;
449
- hookName: H;
450
- plugin: Plugin;
451
- parameters?: unknown[] | undefined;
452
- output?: unknown;
453
- };
454
- type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
455
- hookName: H;
456
- duration: number;
457
- strategy: Strategy;
458
- parameters?: unknown[] | undefined;
459
- plugin: Plugin;
460
- };
461
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
- hookName: H;
463
- plugins: Array<Plugin>;
464
- };
465
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
466
- hookName: H;
467
- };
468
592
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
469
593
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
470
594
  result: Result;
@@ -472,19 +596,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
472
596
  };
473
597
  type Options$1 = {
474
598
  fabric: Fabric;
475
- logger: Logger;
599
+ events: AsyncEventEmitter<KubbEvents>;
476
600
  /**
477
601
  * @default Number.POSITIVE_INFINITY
478
602
  */
479
603
  concurrency?: number;
480
604
  };
481
- type Events = {
482
- progress_start: [meta: ProgressStartMeta];
483
- progress_stop: [meta: ProgressStopMeta];
484
- executing: [meta: ExecutingMeta];
485
- executed: [meta: ExecutedMeta];
486
- error: [error: Error, meta: ErrorMeta];
487
- };
488
605
  type GetFileProps<TOptions = object> = {
489
606
  name: string;
490
607
  mode?: KubbFile.Mode;
@@ -494,10 +611,10 @@ type GetFileProps<TOptions = object> = {
494
611
  };
495
612
  declare class PluginManager {
496
613
  #private;
497
- readonly events: EventEmitter<Events>;
498
614
  readonly config: Config;
499
615
  readonly options: Options$1;
500
616
  constructor(config: Config, options: Options$1);
617
+ get events(): AsyncEventEmitter<KubbEvents>;
501
618
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
502
619
  get plugins(): Array<Plugin>;
503
620
  getFile<TOptions = object>({
@@ -511,10 +628,6 @@ declare class PluginManager {
511
628
  }>;
512
629
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
513
630
  resolveName: (params: ResolveNameParams) => string;
514
- /**
515
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
516
- */
517
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
518
631
  /**
519
632
  * Run a specific hookName for plugin x.
520
633
  */
@@ -698,7 +811,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
698
811
  override: Array<Override<TOptions>> | undefined;
699
812
  contentType: contentType | undefined;
700
813
  pluginManager: PluginManager;
701
- logger?: Logger;
814
+ events?: AsyncEventEmitter<KubbEvents>;
702
815
  /**
703
816
  * Current plugin
704
817
  */
@@ -942,7 +1055,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
1055
  fabric: Fabric;
943
1056
  oas: Oas;
944
1057
  pluginManager: PluginManager;
945
- logger?: Logger;
1058
+ events?: AsyncEventEmitter<KubbEvents>;
946
1059
  /**
947
1060
  * Current plugin
948
1061
  */
@@ -1094,4 +1207,4 @@ type ResolvedOptions = {
1094
1207
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
1095
1208
  //#endregion
1096
1209
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options as t };
1097
- //# sourceMappingURL=types-DosRH6oz.d.cts.map
1210
+ //# sourceMappingURL=types-DjLyok_a.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-cypress",
3
- "version": "4.11.3",
3
+ "version": "4.12.1",
4
4
  "description": "Cypress test generator plugin for Kubb, creating end-to-end tests from OpenAPI specifications for automated API testing.",
5
5
  "keywords": [
6
6
  "cypress",
@@ -74,11 +74,11 @@
74
74
  }
75
75
  ],
76
76
  "dependencies": {
77
- "@kubb/react-fabric": "0.5.4",
78
- "@kubb/core": "4.11.3",
79
- "@kubb/oas": "4.11.3",
80
- "@kubb/plugin-oas": "4.11.3",
81
- "@kubb/plugin-ts": "4.11.3"
77
+ "@kubb/react-fabric": "0.7.0",
78
+ "@kubb/core": "4.12.1",
79
+ "@kubb/oas": "4.12.1",
80
+ "@kubb/plugin-oas": "4.12.1",
81
+ "@kubb/plugin-ts": "4.12.1"
82
82
  },
83
83
  "engines": {
84
84
  "node": ">=20"
@@ -44,7 +44,7 @@ export function Request({ baseURL = '', name, dataReturnType, typeSchemas, url,
44
44
  {dataReturnType === 'data' &&
45
45
  `return cy.request({
46
46
  method: '${method}',
47
- url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\:')}',
47
+ url: \`${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\:')}\`,
48
48
  body: ${body},
49
49
  ...options,
50
50
  }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}
@@ -7,7 +7,7 @@ export function createPets(data: CreatePetsMutationRequest, options?: Partial<Cy
7
7
  return cy
8
8
  .request({
9
9
  method: 'post',
10
- url: '/pets',
10
+ url: `/pets`,
11
11
  body: data,
12
12
  ...options,
13
13
  })
@@ -7,7 +7,7 @@ export function deletePetsPetid(options?: Partial<Cypress.RequestOptions>): Cypr
7
7
  return cy
8
8
  .request({
9
9
  method: 'delete',
10
- url: '/pets/:petId',
10
+ url: `/pets/:petId`,
11
11
  body: undefined,
12
12
  ...options,
13
13
  })
@@ -7,7 +7,7 @@ export function listPets(options?: Partial<Cypress.RequestOptions>): Cypress.Cha
7
7
  return cy
8
8
  .request({
9
9
  method: 'get',
10
- url: '/pets',
10
+ url: `/pets`,
11
11
  body: undefined,
12
12
  ...options,
13
13
  })
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ export function listPets(options?: Partial<Cypress.RequestOptions>): Cypress.Chainable<ListPetsQueryResponse> {
7
+ return cy
8
+ .request({
9
+ method: 'get',
10
+ url: `${123456}/pets`,
11
+ body: undefined,
12
+ ...options,
13
+ })
14
+ .then((res: Cypress.Response<ListPetsQueryResponse>) => res.body)
15
+ }
@@ -7,7 +7,7 @@ export function showPetById(options?: Partial<Cypress.RequestOptions>): Cypress.
7
7
  return cy
8
8
  .request({
9
9
  method: 'get',
10
- url: '/pets/:petId',
10
+ url: `/pets/:petId`,
11
11
  body: undefined,
12
12
  ...options,
13
13
  })
package/src/plugin.ts CHANGED
@@ -85,7 +85,7 @@ export const pluginCypress = definePlugin<PluginCypress>((options) => {
85
85
  fabric: this.fabric,
86
86
  oas,
87
87
  pluginManager: this.pluginManager,
88
- logger: this.logger,
88
+ events: this.events,
89
89
  plugin: this.plugin,
90
90
  contentType,
91
91
  exclude,
@@ -104,7 +104,6 @@ export const pluginCypress = definePlugin<PluginCypress>((options) => {
104
104
  meta: {
105
105
  pluginKey: this.plugin.key,
106
106
  },
107
- logger: this.logger,
108
107
  })
109
108
 
110
109
  await this.upsertFile(...barrelFiles)