@kubb/plugin-cypress 4.5.1 → 4.5.3

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.
@@ -1,4 +1,4 @@
1
- import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-C36mkyaA.cjs";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DVje6w9z.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-Da3VNOH7.js";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DbU-_Igx.js";
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 { n as PluginCypress, r as ReactGenerator } from "./types-C36mkyaA.cjs";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-DVje6w9z.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-Da3VNOH7.js";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-DbU-_Igx.js";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ __kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
13
13
 
14
14
  //#region src/plugin.ts
15
15
  const pluginCypressName = "plugin-cypress";
16
- const pluginCypress = (0, __kubb_core.createPlugin)((options) => {
16
+ const pluginCypress = (0, __kubb_core.definePlugin)((options) => {
17
17
  const { output = {
18
18
  path: "cypress",
19
19
  barrelType: "named"
@@ -49,11 +49,10 @@ const pluginCypress = (0, __kubb_core.createPlugin)((options) => {
49
49
  if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
50
50
  return resolvedName;
51
51
  },
52
- async buildStart() {
53
- const [swaggerPlugin] = __kubb_core.PluginManager.getDependedPlugins(this.plugins, [__kubb_plugin_oas.pluginOasName]);
54
- const oas = await swaggerPlugin.context.getOas();
52
+ async install() {
55
53
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
56
54
  const mode = (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path));
55
+ const oas = await this.getOas();
57
56
  const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
58
57
  fabric: this.fabric,
59
58
  oas,
@@ -66,7 +65,7 @@ const pluginCypress = (0, __kubb_core.createPlugin)((options) => {
66
65
  mode
67
66
  }).build(...generators);
68
67
  await this.addFile(...files);
69
- const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fileManager.files, {
68
+ const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fabric.files, {
70
69
  type: output.barrelType ?? "named",
71
70
  root,
72
71
  output,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["cypressGenerator","pluginOasName","pluginTsName","path","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.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.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;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I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOE,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAcrD,MAAM,QAAQ,MAZa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,sCAAqB,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;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 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.addFile(...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.addFile(...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,aAC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ACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,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,QAAQ,GAAG,YAAY;;EAErC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-C36mkyaA.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DVje6w9z.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-Da3VNOH7.js";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DbU-_Igx.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import "./components-Cs-85WSv.js";
2
2
  import { t as cypressGenerator } from "./generators-CRS7mkLj.js";
3
3
  import path from "node:path";
4
- import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
4
+ import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
5
5
  import { camelCase } from "@kubb/core/transformers";
6
6
  import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
7
7
  import { pluginTsName } from "@kubb/plugin-ts";
8
8
 
9
9
  //#region src/plugin.ts
10
10
  const pluginCypressName = "plugin-cypress";
11
- const pluginCypress = createPlugin((options) => {
11
+ const pluginCypress = definePlugin((options) => {
12
12
  const { output = {
13
13
  path: "cypress",
14
14
  barrelType: "named"
@@ -44,11 +44,10 @@ const pluginCypress = createPlugin((options) => {
44
44
  if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
45
45
  return resolvedName;
46
46
  },
47
- async buildStart() {
48
- const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
49
- const oas = await swaggerPlugin.context.getOas();
47
+ async install() {
50
48
  const root = path.resolve(this.config.root, this.config.output.path);
51
49
  const mode = getMode(path.resolve(root, output.path));
50
+ const oas = await this.getOas();
52
51
  const files = await new OperationGenerator(this.plugin.options, {
53
52
  fabric: this.fabric,
54
53
  oas,
@@ -61,7 +60,7 @@ const pluginCypress = createPlugin((options) => {
61
60
  mode
62
61
  }).build(...generators);
63
62
  await this.addFile(...files);
64
- const barrelFiles = await getBarrelFiles(this.fileManager.files, {
63
+ const barrelFiles = await getBarrelFiles(this.fabric.files, {
65
64
  type: output.barrelType ?? "named",
66
65
  root,
67
66
  output,
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 { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.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.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;AASA,MAAa,oBAAoB;AAEjC,MAAa,gBAAgB,cAA6B,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iB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M,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAcrD,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,eAAe,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;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 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.addFile(...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.addFile(...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,OA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ACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
@@ -1,4 +1,3 @@
1
- import { Fabric, FileManager } from "@kubb/react-fabric";
2
1
  import * as OasTypes from "oas/types";
3
2
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
4
3
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -6,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
6
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
6
  import BaseOas from "oas";
8
7
  import { KubbFile } from "@kubb/fabric-core/types";
8
+ import { Fabric } from "@kubb/react-fabric";
9
9
  import { ConsolaInstance, LogLevel } from "consola";
10
10
  import { KubbNode } from "@kubb/react-fabric/types";
11
11
 
@@ -110,6 +110,21 @@ type Logger = {
110
110
  type PossiblePromise<T> = Promise<T> | T;
111
111
  //#endregion
112
112
  //#region ../core/src/types.d.ts
113
+ declare global {
114
+ namespace Kubb {
115
+ interface PluginContext {}
116
+ }
117
+ }
118
+ /**
119
+ * Config used in `kubb.config.ts`
120
+ *
121
+ * @example
122
+ * import { defineConfig } from '@kubb/core'
123
+ * export default defineConfig({
124
+ * ...
125
+ * })
126
+ */
127
+
113
128
  type InputPath = {
114
129
  /**
115
130
  * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.
@@ -264,11 +279,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
264
279
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
265
280
  */
266
281
  post?: Array<string>;
267
- } & (TOptions['context'] extends never ? {
268
- context?: never;
269
- } : {
270
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
271
- });
282
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
283
+ };
272
284
  type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
273
285
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
274
286
  /**
@@ -294,25 +306,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
294
306
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
295
307
  */
296
308
  options: TOptions['resolvedOptions'];
297
- } & (TOptions['context'] extends never ? {
298
- context?: never;
299
- } : {
300
- context: TOptions['context'];
301
- });
309
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
310
+ /**
311
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
312
+ */
313
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
314
+ };
302
315
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
303
316
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
304
317
  /**
305
318
  * Start of the lifecycle of a plugin.
306
319
  * @type hookParallel
307
320
  */
308
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
321
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
309
322
  /**
310
323
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
311
324
  * Options can als be included.
312
325
  * @type hookFirst
313
326
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
314
327
  */
315
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
328
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
316
329
  /**
317
330
  * Resolve to a name based on a string.
318
331
  * Useful when converting to PascalCase or camelCase.
@@ -320,11 +333,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
320
333
  * @example ('pet') => 'Pet'
321
334
  */
322
335
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
323
- /**
324
- * End of the plugin lifecycle.
325
- * @type hookParallel
326
- */
327
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
328
336
  };
329
337
  type PluginLifecycleHooks = keyof PluginLifecycle;
330
338
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -351,24 +359,15 @@ type ResolveNameParams = {
351
359
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
352
360
  fabric: Fabric;
353
361
  config: Config;
354
- /**
355
- * @deprecated
356
- */
357
- fileManager: FileManager;
358
362
  pluginManager: PluginManager;
359
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
360
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
361
- resolveName: (params: ResolveNameParams) => string;
363
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
362
364
  logger: Logger;
363
- /**
364
- * All plugins
365
- */
366
- plugins: Plugin[];
365
+ mode: KubbFile.Mode;
367
366
  /**
368
367
  * Current plugin
369
368
  */
370
369
  plugin: Plugin<TOptions>;
371
- };
370
+ } & Kubb.PluginContext;
372
371
  /**
373
372
  * Specify the export location for the files and define the behavior of the output
374
373
  */
@@ -443,13 +442,14 @@ type GetFileProps<TOptions = object> = {
443
442
  };
444
443
  declare class PluginManager {
445
444
  #private;
446
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
447
445
  readonly events: EventEmitter<Events>;
448
446
  readonly config: Config;
449
447
  readonly executed: Array<Executer>;
450
448
  readonly logger: Logger;
451
449
  readonly options: Options$2;
452
450
  constructor(config: Config, options: Options$2);
451
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
452
+ get plugins(): Array<Plugin>;
453
453
  getFile<TOptions = object>({
454
454
  name,
455
455
  mode,
@@ -459,7 +459,7 @@ declare class PluginManager {
459
459
  }: GetFileProps<TOptions>): KubbFile.File<{
460
460
  pluginKey: Plugin['key'];
461
461
  }>;
462
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
462
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
463
463
  resolveName: (params: ResolveNameParams) => string;
464
464
  /**
465
465
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -547,15 +547,140 @@ declare class PluginManager {
547
547
  }): Promise<void>;
548
548
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
549
549
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
550
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
551
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
552
550
  }
553
551
  //#endregion
554
- //#region ../core/src/FileManager.d.ts
552
+ //#region ../core/src/utils/getBarrelFiles.d.ts
555
553
  type FileMetaBase = {
556
554
  pluginKey?: Plugin['key'];
557
555
  };
558
556
  //#endregion
557
+ //#region ../plugin-oas/src/types.d.ts
558
+ type Context$2 = {
559
+ getOas(): Promise<Oas>;
560
+ getBaseURL(): Promise<string | undefined>;
561
+ };
562
+ declare global {
563
+ namespace Kubb {
564
+ interface PluginContext extends Context$2 {}
565
+ }
566
+ }
567
+ type ResolvePathOptions = {
568
+ pluginKey?: Plugin['key'];
569
+ group?: {
570
+ tag?: string;
571
+ path?: string;
572
+ };
573
+ type?: ResolveNameParams['type'];
574
+ };
575
+ /**
576
+ * `propertyName` is the ref name + resolved with the nameResolver
577
+ * @example import { Pet } from './Pet'
578
+ *
579
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
580
+ *
581
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
582
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
583
+ */
584
+ type Ref = {
585
+ propertyName: string;
586
+ originalName: string;
587
+ path: KubbFile.Path;
588
+ pluginKey?: Plugin['key'];
589
+ };
590
+ type Refs = Record<string, Ref>;
591
+ type OperationSchema = {
592
+ /**
593
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
594
+ */
595
+ name: string;
596
+ schema: SchemaObject$1;
597
+ operation?: Operation$1;
598
+ /**
599
+ * OperationName in PascalCase, only being used in OperationGenerator
600
+ */
601
+ operationName: string;
602
+ description?: string;
603
+ statusCode?: number;
604
+ keys?: string[];
605
+ keysToOmit?: string[];
606
+ withData?: boolean;
607
+ };
608
+ type OperationSchemas = {
609
+ pathParams?: OperationSchema & {
610
+ keysToOmit?: never;
611
+ };
612
+ queryParams?: OperationSchema & {
613
+ keysToOmit?: never;
614
+ };
615
+ headerParams?: OperationSchema & {
616
+ keysToOmit?: never;
617
+ };
618
+ request?: OperationSchema;
619
+ response: OperationSchema;
620
+ responses: Array<OperationSchema>;
621
+ statusCodes?: Array<OperationSchema>;
622
+ errors?: Array<OperationSchema>;
623
+ };
624
+ type ByTag = {
625
+ type: 'tag';
626
+ pattern: string | RegExp;
627
+ };
628
+ type ByOperationId = {
629
+ type: 'operationId';
630
+ pattern: string | RegExp;
631
+ };
632
+ type ByPath = {
633
+ type: 'path';
634
+ pattern: string | RegExp;
635
+ };
636
+ type ByMethod = {
637
+ type: 'method';
638
+ pattern: HttpMethod | RegExp;
639
+ };
640
+ type BySchemaName = {
641
+ type: 'schemaName';
642
+ pattern: string | RegExp;
643
+ };
644
+ type ByContentType = {
645
+ type: 'contentType';
646
+ pattern: string | RegExp;
647
+ };
648
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
649
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
650
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
651
+ options: Partial<TOptions>;
652
+ };
653
+ //#endregion
654
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
655
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
656
+ fabric: Fabric;
657
+ oas: Oas;
658
+ exclude: Array<Exclude$1> | undefined;
659
+ include: Array<Include> | undefined;
660
+ override: Array<Override<TOptions>> | undefined;
661
+ contentType: contentType | undefined;
662
+ pluginManager: PluginManager;
663
+ /**
664
+ * Current plugin
665
+ */
666
+ plugin: Plugin<TPluginOptions>;
667
+ mode: KubbFile.Mode;
668
+ };
669
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
670
+ #private;
671
+ getSchemas(operation: Operation$1, {
672
+ resolveName
673
+ }?: {
674
+ resolveName?: (name: string) => string;
675
+ }): OperationSchemas;
676
+ getOperations(): Promise<Array<{
677
+ path: string;
678
+ method: HttpMethod;
679
+ operation: Operation$1;
680
+ }>>;
681
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
682
+ }
683
+ //#endregion
559
684
  //#region ../plugin-oas/src/SchemaMapper.d.ts
560
685
  type SchemaKeywordMapper = {
561
686
  object: {
@@ -669,7 +794,7 @@ type SchemaKeywordMapper = {
669
794
  /**
670
795
  * Full qualified path.
671
796
  */
672
- path: KubbFile.OptionalPath;
797
+ path: KubbFile.Path;
673
798
  /**
674
799
  * When true `File.Import` will be used.
675
800
  * When false a reference will be used inside the current file.
@@ -773,96 +898,8 @@ type Schema = {
773
898
  keyword: string;
774
899
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
775
900
  //#endregion
776
- //#region ../plugin-oas/src/types.d.ts
777
- type ResolvePathOptions = {
778
- pluginKey?: Plugin['key'];
779
- group?: {
780
- tag?: string;
781
- path?: string;
782
- };
783
- type?: ResolveNameParams['type'];
784
- };
785
- /**
786
- * `propertyName` is the ref name + resolved with the nameResolver
787
- * @example import { Pet } from './Pet'
788
- *
789
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
790
- *
791
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
792
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
793
- */
794
- type Ref = {
795
- propertyName: string;
796
- originalName: string;
797
- path: KubbFile.OptionalPath;
798
- pluginKey?: Plugin['key'];
799
- };
800
- type Refs = Record<string, Ref>;
801
- type OperationSchema = {
802
- /**
803
- * Converted name, contains already `PathParams`, `QueryParams`, ...
804
- */
805
- name: string;
806
- schema: SchemaObject$1;
807
- operation?: Operation$1;
808
- /**
809
- * OperationName in PascalCase, only being used in OperationGenerator
810
- */
811
- operationName: string;
812
- description?: string;
813
- statusCode?: number;
814
- keys?: string[];
815
- keysToOmit?: string[];
816
- withData?: boolean;
817
- };
818
- type OperationSchemas = {
819
- pathParams?: OperationSchema & {
820
- keysToOmit?: never;
821
- };
822
- queryParams?: OperationSchema & {
823
- keysToOmit?: never;
824
- };
825
- headerParams?: OperationSchema & {
826
- keysToOmit?: never;
827
- };
828
- request?: OperationSchema;
829
- response: OperationSchema;
830
- responses: Array<OperationSchema>;
831
- statusCodes?: Array<OperationSchema>;
832
- errors?: Array<OperationSchema>;
833
- };
834
- type ByTag = {
835
- type: 'tag';
836
- pattern: string | RegExp;
837
- };
838
- type ByOperationId = {
839
- type: 'operationId';
840
- pattern: string | RegExp;
841
- };
842
- type ByPath = {
843
- type: 'path';
844
- pattern: string | RegExp;
845
- };
846
- type ByMethod = {
847
- type: 'method';
848
- pattern: HttpMethod | RegExp;
849
- };
850
- type BySchemaName = {
851
- type: 'schemaName';
852
- pattern: string | RegExp;
853
- };
854
- type ByContentType = {
855
- type: 'contentType';
856
- pattern: string | RegExp;
857
- };
858
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
859
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
860
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
861
- options: Partial<TOptions>;
862
- };
863
- //#endregion
864
901
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
865
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
902
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
866
903
  fabric: Fabric;
867
904
  oas: Oas;
868
905
  pluginManager: PluginManager;
@@ -903,7 +940,7 @@ type SchemaProps$1 = {
903
940
  name?: string;
904
941
  parentName?: string;
905
942
  };
906
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
943
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
907
944
  #private;
908
945
  refs: Refs;
909
946
  /**
@@ -918,15 +955,6 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
918
955
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
919
956
  }
920
957
  //#endregion
921
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
922
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
923
- name: string;
924
- type: 'core';
925
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
926
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
927
- schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
928
- };
929
- //#endregion
930
958
  //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
931
959
  type ReactGenerator<TOptions extends PluginFactoryOptions> = {
932
960
  name: string;
@@ -961,35 +989,14 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
961
989
  };
962
990
  type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
963
991
  //#endregion
964
- //#region ../plugin-oas/src/OperationGenerator.d.ts
965
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
966
- fabric: Fabric;
967
- oas: Oas;
968
- exclude: Array<Exclude$1> | undefined;
969
- include: Array<Include> | undefined;
970
- override: Array<Override<TOptions>> | undefined;
971
- contentType: contentType | undefined;
972
- pluginManager: PluginManager;
973
- /**
974
- * Current plugin
975
- */
976
- plugin: Plugin<TPluginOptions>;
977
- mode: KubbFile.Mode;
992
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
993
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
994
+ name: string;
995
+ type: 'core';
996
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
997
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
998
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
978
999
  };
979
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
980
- #private;
981
- getSchemas(operation: Operation$1, {
982
- resolveName
983
- }?: {
984
- resolveName?: (name: string) => string;
985
- }): OperationSchemas;
986
- getOperations(): Promise<Array<{
987
- path: string;
988
- method: HttpMethod;
989
- operation: Operation$1;
990
- }>>;
991
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
992
- }
993
1000
  //#endregion
994
1001
  //#region src/types.d.ts
995
1002
  type Options$1 = {
@@ -1047,4 +1054,4 @@ type ResolvedOptions = {
1047
1054
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1048
1055
  //#endregion
1049
1056
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options$1 as t };
1050
- //# sourceMappingURL=types-Da3VNOH7.d.ts.map
1057
+ //# sourceMappingURL=types-DVje6w9z.d.cts.map
@@ -1,3 +1,4 @@
1
+ import { Fabric } from "@kubb/react-fabric";
1
2
  import * as OasTypes from "oas/types";
2
3
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
3
4
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -5,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
5
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
7
  import BaseOas from "oas";
7
8
  import { KubbFile } from "@kubb/fabric-core/types";
8
- import { Fabric, FileManager } from "@kubb/react-fabric";
9
9
  import { ConsolaInstance, LogLevel } from "consola";
10
10
  import { KubbNode } from "@kubb/react-fabric/types";
11
11
 
@@ -110,6 +110,21 @@ type Logger = {
110
110
  type PossiblePromise<T> = Promise<T> | T;
111
111
  //#endregion
112
112
  //#region ../core/src/types.d.ts
113
+ declare global {
114
+ namespace Kubb {
115
+ interface PluginContext {}
116
+ }
117
+ }
118
+ /**
119
+ * Config used in `kubb.config.ts`
120
+ *
121
+ * @example
122
+ * import { defineConfig } from '@kubb/core'
123
+ * export default defineConfig({
124
+ * ...
125
+ * })
126
+ */
127
+
113
128
  type InputPath = {
114
129
  /**
115
130
  * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.
@@ -264,11 +279,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
264
279
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
265
280
  */
266
281
  post?: Array<string>;
267
- } & (TOptions['context'] extends never ? {
268
- context?: never;
269
- } : {
270
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
271
- });
282
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
283
+ };
272
284
  type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
273
285
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
274
286
  /**
@@ -294,25 +306,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
294
306
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
295
307
  */
296
308
  options: TOptions['resolvedOptions'];
297
- } & (TOptions['context'] extends never ? {
298
- context?: never;
299
- } : {
300
- context: TOptions['context'];
301
- });
309
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
310
+ /**
311
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
312
+ */
313
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
314
+ };
302
315
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
303
316
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
304
317
  /**
305
318
  * Start of the lifecycle of a plugin.
306
319
  * @type hookParallel
307
320
  */
308
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
321
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
309
322
  /**
310
323
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
311
324
  * Options can als be included.
312
325
  * @type hookFirst
313
326
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
314
327
  */
315
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
328
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
316
329
  /**
317
330
  * Resolve to a name based on a string.
318
331
  * Useful when converting to PascalCase or camelCase.
@@ -320,11 +333,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
320
333
  * @example ('pet') => 'Pet'
321
334
  */
322
335
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
323
- /**
324
- * End of the plugin lifecycle.
325
- * @type hookParallel
326
- */
327
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
328
336
  };
329
337
  type PluginLifecycleHooks = keyof PluginLifecycle;
330
338
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -351,24 +359,15 @@ type ResolveNameParams = {
351
359
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
352
360
  fabric: Fabric;
353
361
  config: Config;
354
- /**
355
- * @deprecated
356
- */
357
- fileManager: FileManager;
358
362
  pluginManager: PluginManager;
359
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
360
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
361
- resolveName: (params: ResolveNameParams) => string;
363
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
362
364
  logger: Logger;
363
- /**
364
- * All plugins
365
- */
366
- plugins: Plugin[];
365
+ mode: KubbFile.Mode;
367
366
  /**
368
367
  * Current plugin
369
368
  */
370
369
  plugin: Plugin<TOptions>;
371
- };
370
+ } & Kubb.PluginContext;
372
371
  /**
373
372
  * Specify the export location for the files and define the behavior of the output
374
373
  */
@@ -443,13 +442,14 @@ type GetFileProps<TOptions = object> = {
443
442
  };
444
443
  declare class PluginManager {
445
444
  #private;
446
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
447
445
  readonly events: EventEmitter<Events>;
448
446
  readonly config: Config;
449
447
  readonly executed: Array<Executer>;
450
448
  readonly logger: Logger;
451
449
  readonly options: Options$2;
452
450
  constructor(config: Config, options: Options$2);
451
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
452
+ get plugins(): Array<Plugin>;
453
453
  getFile<TOptions = object>({
454
454
  name,
455
455
  mode,
@@ -459,7 +459,7 @@ declare class PluginManager {
459
459
  }: GetFileProps<TOptions>): KubbFile.File<{
460
460
  pluginKey: Plugin['key'];
461
461
  }>;
462
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
462
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
463
463
  resolveName: (params: ResolveNameParams) => string;
464
464
  /**
465
465
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -547,15 +547,140 @@ declare class PluginManager {
547
547
  }): Promise<void>;
548
548
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
549
549
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
550
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
551
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
552
550
  }
553
551
  //#endregion
554
- //#region ../core/src/FileManager.d.ts
552
+ //#region ../core/src/utils/getBarrelFiles.d.ts
555
553
  type FileMetaBase = {
556
554
  pluginKey?: Plugin['key'];
557
555
  };
558
556
  //#endregion
557
+ //#region ../plugin-oas/src/types.d.ts
558
+ type Context$2 = {
559
+ getOas(): Promise<Oas>;
560
+ getBaseURL(): Promise<string | undefined>;
561
+ };
562
+ declare global {
563
+ namespace Kubb {
564
+ interface PluginContext extends Context$2 {}
565
+ }
566
+ }
567
+ type ResolvePathOptions = {
568
+ pluginKey?: Plugin['key'];
569
+ group?: {
570
+ tag?: string;
571
+ path?: string;
572
+ };
573
+ type?: ResolveNameParams['type'];
574
+ };
575
+ /**
576
+ * `propertyName` is the ref name + resolved with the nameResolver
577
+ * @example import { Pet } from './Pet'
578
+ *
579
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
580
+ *
581
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
582
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
583
+ */
584
+ type Ref = {
585
+ propertyName: string;
586
+ originalName: string;
587
+ path: KubbFile.Path;
588
+ pluginKey?: Plugin['key'];
589
+ };
590
+ type Refs = Record<string, Ref>;
591
+ type OperationSchema = {
592
+ /**
593
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
594
+ */
595
+ name: string;
596
+ schema: SchemaObject$1;
597
+ operation?: Operation$1;
598
+ /**
599
+ * OperationName in PascalCase, only being used in OperationGenerator
600
+ */
601
+ operationName: string;
602
+ description?: string;
603
+ statusCode?: number;
604
+ keys?: string[];
605
+ keysToOmit?: string[];
606
+ withData?: boolean;
607
+ };
608
+ type OperationSchemas = {
609
+ pathParams?: OperationSchema & {
610
+ keysToOmit?: never;
611
+ };
612
+ queryParams?: OperationSchema & {
613
+ keysToOmit?: never;
614
+ };
615
+ headerParams?: OperationSchema & {
616
+ keysToOmit?: never;
617
+ };
618
+ request?: OperationSchema;
619
+ response: OperationSchema;
620
+ responses: Array<OperationSchema>;
621
+ statusCodes?: Array<OperationSchema>;
622
+ errors?: Array<OperationSchema>;
623
+ };
624
+ type ByTag = {
625
+ type: 'tag';
626
+ pattern: string | RegExp;
627
+ };
628
+ type ByOperationId = {
629
+ type: 'operationId';
630
+ pattern: string | RegExp;
631
+ };
632
+ type ByPath = {
633
+ type: 'path';
634
+ pattern: string | RegExp;
635
+ };
636
+ type ByMethod = {
637
+ type: 'method';
638
+ pattern: HttpMethod | RegExp;
639
+ };
640
+ type BySchemaName = {
641
+ type: 'schemaName';
642
+ pattern: string | RegExp;
643
+ };
644
+ type ByContentType = {
645
+ type: 'contentType';
646
+ pattern: string | RegExp;
647
+ };
648
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
649
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
650
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
651
+ options: Partial<TOptions>;
652
+ };
653
+ //#endregion
654
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
655
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
656
+ fabric: Fabric;
657
+ oas: Oas;
658
+ exclude: Array<Exclude$1> | undefined;
659
+ include: Array<Include> | undefined;
660
+ override: Array<Override<TOptions>> | undefined;
661
+ contentType: contentType | undefined;
662
+ pluginManager: PluginManager;
663
+ /**
664
+ * Current plugin
665
+ */
666
+ plugin: Plugin<TPluginOptions>;
667
+ mode: KubbFile.Mode;
668
+ };
669
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
670
+ #private;
671
+ getSchemas(operation: Operation$1, {
672
+ resolveName
673
+ }?: {
674
+ resolveName?: (name: string) => string;
675
+ }): OperationSchemas;
676
+ getOperations(): Promise<Array<{
677
+ path: string;
678
+ method: HttpMethod;
679
+ operation: Operation$1;
680
+ }>>;
681
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
682
+ }
683
+ //#endregion
559
684
  //#region ../plugin-oas/src/SchemaMapper.d.ts
560
685
  type SchemaKeywordMapper = {
561
686
  object: {
@@ -669,7 +794,7 @@ type SchemaKeywordMapper = {
669
794
  /**
670
795
  * Full qualified path.
671
796
  */
672
- path: KubbFile.OptionalPath;
797
+ path: KubbFile.Path;
673
798
  /**
674
799
  * When true `File.Import` will be used.
675
800
  * When false a reference will be used inside the current file.
@@ -773,96 +898,8 @@ type Schema = {
773
898
  keyword: string;
774
899
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
775
900
  //#endregion
776
- //#region ../plugin-oas/src/types.d.ts
777
- type ResolvePathOptions = {
778
- pluginKey?: Plugin['key'];
779
- group?: {
780
- tag?: string;
781
- path?: string;
782
- };
783
- type?: ResolveNameParams['type'];
784
- };
785
- /**
786
- * `propertyName` is the ref name + resolved with the nameResolver
787
- * @example import { Pet } from './Pet'
788
- *
789
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
790
- *
791
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
792
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
793
- */
794
- type Ref = {
795
- propertyName: string;
796
- originalName: string;
797
- path: KubbFile.OptionalPath;
798
- pluginKey?: Plugin['key'];
799
- };
800
- type Refs = Record<string, Ref>;
801
- type OperationSchema = {
802
- /**
803
- * Converted name, contains already `PathParams`, `QueryParams`, ...
804
- */
805
- name: string;
806
- schema: SchemaObject$1;
807
- operation?: Operation$1;
808
- /**
809
- * OperationName in PascalCase, only being used in OperationGenerator
810
- */
811
- operationName: string;
812
- description?: string;
813
- statusCode?: number;
814
- keys?: string[];
815
- keysToOmit?: string[];
816
- withData?: boolean;
817
- };
818
- type OperationSchemas = {
819
- pathParams?: OperationSchema & {
820
- keysToOmit?: never;
821
- };
822
- queryParams?: OperationSchema & {
823
- keysToOmit?: never;
824
- };
825
- headerParams?: OperationSchema & {
826
- keysToOmit?: never;
827
- };
828
- request?: OperationSchema;
829
- response: OperationSchema;
830
- responses: Array<OperationSchema>;
831
- statusCodes?: Array<OperationSchema>;
832
- errors?: Array<OperationSchema>;
833
- };
834
- type ByTag = {
835
- type: 'tag';
836
- pattern: string | RegExp;
837
- };
838
- type ByOperationId = {
839
- type: 'operationId';
840
- pattern: string | RegExp;
841
- };
842
- type ByPath = {
843
- type: 'path';
844
- pattern: string | RegExp;
845
- };
846
- type ByMethod = {
847
- type: 'method';
848
- pattern: HttpMethod | RegExp;
849
- };
850
- type BySchemaName = {
851
- type: 'schemaName';
852
- pattern: string | RegExp;
853
- };
854
- type ByContentType = {
855
- type: 'contentType';
856
- pattern: string | RegExp;
857
- };
858
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
859
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
860
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
861
- options: Partial<TOptions>;
862
- };
863
- //#endregion
864
901
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
865
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
902
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
866
903
  fabric: Fabric;
867
904
  oas: Oas;
868
905
  pluginManager: PluginManager;
@@ -903,7 +940,7 @@ type SchemaProps$1 = {
903
940
  name?: string;
904
941
  parentName?: string;
905
942
  };
906
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
943
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
907
944
  #private;
908
945
  refs: Refs;
909
946
  /**
@@ -918,15 +955,6 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
918
955
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
919
956
  }
920
957
  //#endregion
921
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
922
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
923
- name: string;
924
- type: 'core';
925
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
926
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
927
- schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
928
- };
929
- //#endregion
930
958
  //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
931
959
  type ReactGenerator<TOptions extends PluginFactoryOptions> = {
932
960
  name: string;
@@ -961,35 +989,14 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
961
989
  };
962
990
  type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
963
991
  //#endregion
964
- //#region ../plugin-oas/src/OperationGenerator.d.ts
965
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
966
- fabric: Fabric;
967
- oas: Oas;
968
- exclude: Array<Exclude$1> | undefined;
969
- include: Array<Include> | undefined;
970
- override: Array<Override<TOptions>> | undefined;
971
- contentType: contentType | undefined;
972
- pluginManager: PluginManager;
973
- /**
974
- * Current plugin
975
- */
976
- plugin: Plugin<TPluginOptions>;
977
- mode: KubbFile.Mode;
992
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
993
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
994
+ name: string;
995
+ type: 'core';
996
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
997
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
998
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
978
999
  };
979
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
980
- #private;
981
- getSchemas(operation: Operation$1, {
982
- resolveName
983
- }?: {
984
- resolveName?: (name: string) => string;
985
- }): OperationSchemas;
986
- getOperations(): Promise<Array<{
987
- path: string;
988
- method: HttpMethod;
989
- operation: Operation$1;
990
- }>>;
991
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
992
- }
993
1000
  //#endregion
994
1001
  //#region src/types.d.ts
995
1002
  type Options$1 = {
@@ -1047,4 +1054,4 @@ type ResolvedOptions = {
1047
1054
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1048
1055
  //#endregion
1049
1056
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options$1 as t };
1050
- //# sourceMappingURL=types-C36mkyaA.d.cts.map
1057
+ //# sourceMappingURL=types-DbU-_Igx.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-cypress",
3
- "version": "4.5.1",
3
+ "version": "4.5.3",
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,15 +74,15 @@
74
74
  }
75
75
  ],
76
76
  "dependencies": {
77
- "@kubb/react-fabric": "0.2.14",
78
- "@kubb/core": "4.5.1",
79
- "@kubb/oas": "4.5.1",
80
- "@kubb/plugin-oas": "4.5.1",
81
- "@kubb/plugin-ts": "4.5.1"
77
+ "@kubb/react-fabric": "0.2.19",
78
+ "@kubb/core": "4.5.3",
79
+ "@kubb/oas": "4.5.3",
80
+ "@kubb/plugin-oas": "4.5.3",
81
+ "@kubb/plugin-ts": "4.5.3"
82
82
  },
83
83
  "devDependencies": {},
84
84
  "peerDependencies": {
85
- "@kubb/react-fabric": "0.2.14"
85
+ "@kubb/react-fabric": "0.2.19"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=20"
package/src/plugin.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
- import { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'
2
+ import { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'
3
3
  import { camelCase } from '@kubb/core/transformers'
4
- import type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'
5
4
  import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
6
5
  import { pluginTsName } from '@kubb/plugin-ts'
7
6
  import { cypressGenerator } from './generators'
@@ -9,7 +8,7 @@ import type { PluginCypress } from './types.ts'
9
8
 
10
9
  export const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']
11
10
 
12
- export const pluginCypress = createPlugin<PluginCypress>((options) => {
11
+ export const pluginCypress = definePlugin<PluginCypress>((options) => {
13
12
  const {
14
13
  output = { path: 'cypress', barrelType: 'named' },
15
14
  group,
@@ -77,12 +76,10 @@ export const pluginCypress = createPlugin<PluginCypress>((options) => {
77
76
 
78
77
  return resolvedName
79
78
  },
80
- async buildStart() {
81
- const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])
82
-
83
- const oas = await swaggerPlugin.context.getOas()
79
+ async install() {
84
80
  const root = path.resolve(this.config.root, this.config.output.path)
85
81
  const mode = getMode(path.resolve(root, output.path))
82
+ const oas = await this.getOas()
86
83
 
87
84
  const operationGenerator = new OperationGenerator(this.plugin.options, {
88
85
  fabric: this.fabric,
@@ -99,7 +96,7 @@ export const pluginCypress = createPlugin<PluginCypress>((options) => {
99
96
  const files = await operationGenerator.build(...generators)
100
97
  await this.addFile(...files)
101
98
 
102
- const barrelFiles = await getBarrelFiles(this.fileManager.files, {
99
+ const barrelFiles = await getBarrelFiles(this.fabric.files, {
103
100
  type: output.barrelType ?? 'named',
104
101
  root,
105
102
  output,