@kubb/plugin-client 5.0.0-alpha.34 → 5.0.0-alpha.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import * as _$_kubb_core0 from "@kubb/core";
3
- import { CompatibilityPreset, Exclude, FunctionParams, Generator, Group, Include, Output, Override, PluginFactoryOptions, ResolvePathOptions, Resolver, UserGroup } from "@kubb/core";
3
+ import { CompatibilityPreset, Exclude, FunctionParams, Generator, Group, Include, Output, Override, PluginFactoryOptions, ResolvePathOptions, Resolver, UserGroup, ast } from "@kubb/core";
4
4
  import { PluginTs } from "@kubb/plugin-ts";
5
5
  import { PluginZod } from "@kubb/plugin-zod";
6
- import { FunctionParametersNode, OperationNode, Visitor } from "@kubb/ast/types";
7
6
  import { KubbReactNode } from "@kubb/renderer-jsx/types";
8
7
 
9
8
  //#region src/types.d.ts
@@ -182,7 +181,7 @@ type Options = {
182
181
  * Single AST visitor applied to each node before printing.
183
182
  * Return `null` or `undefined` from a method to leave the node unchanged.
184
183
  */
185
- transformer?: Visitor;
184
+ transformer?: ast.Visitor;
186
185
  /**
187
186
  * Define some generators next to the client generators.
188
187
  */
@@ -231,7 +230,7 @@ type Props$1 = {
231
230
  paramsType: PluginClient['resolvedOptions']['pathParamsType'];
232
231
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
233
232
  parser: PluginClient['resolvedOptions']['parser'] | undefined;
234
- node: OperationNode;
233
+ node: ast.OperationNode;
235
234
  tsResolver: PluginTs['resolver'];
236
235
  zodResolver?: PluginZod['resolver'];
237
236
  children?: KubbReactNode;
@@ -240,7 +239,7 @@ type GetParamsProps$1 = {
240
239
  paramsCasing: PluginClient['resolvedOptions']['paramsCasing'];
241
240
  paramsType: PluginClient['resolvedOptions']['paramsType'];
242
241
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
243
- node: OperationNode;
242
+ node: ast.OperationNode;
244
243
  tsResolver: PluginTs['resolver'];
245
244
  isConfigurable: boolean;
246
245
  };
@@ -270,7 +269,7 @@ declare namespace Client {
270
269
  node,
271
270
  tsResolver,
272
271
  isConfigurable
273
- }: GetParamsProps$1) => FunctionParametersNode;
272
+ }: GetParamsProps$1) => ast.FunctionParametersNode;
274
273
  }
275
274
  //#endregion
276
275
  //#region src/components/ClientLegacy.d.ts
@@ -400,19 +399,19 @@ declare namespace UrlLegacy {
400
399
  }
401
400
  //#endregion
402
401
  //#region src/generators/classClientGenerator.d.ts
403
- declare const classClientGenerator: _$_kubb_core0.Generator<PluginClient>;
402
+ declare const classClientGenerator: _$_kubb_core0.Generator<PluginClient, unknown>;
404
403
  //#endregion
405
404
  //#region src/generators/clientGenerator.d.ts
406
- declare const clientGenerator: _$_kubb_core0.Generator<PluginClient>;
405
+ declare const clientGenerator: _$_kubb_core0.Generator<PluginClient, unknown>;
407
406
  //#endregion
408
407
  //#region src/generators/groupedClientGenerator.d.ts
409
- declare const groupedClientGenerator: _$_kubb_core0.Generator<PluginClient>;
408
+ declare const groupedClientGenerator: _$_kubb_core0.Generator<PluginClient, unknown>;
410
409
  //#endregion
411
410
  //#region src/generators/operationsGenerator.d.ts
412
- declare const operationsGenerator: _$_kubb_core0.Generator<PluginClient>;
411
+ declare const operationsGenerator: _$_kubb_core0.Generator<PluginClient, unknown>;
413
412
  //#endregion
414
413
  //#region src/generators/staticClassClientGenerator.d.ts
415
- declare const staticClassClientGenerator: _$_kubb_core0.Generator<PluginClient>;
414
+ declare const staticClassClientGenerator: _$_kubb_core0.Generator<PluginClient, unknown>;
416
415
  //#endregion
417
416
  //#region src/plugin.d.ts
418
417
  /**
@@ -436,20 +435,7 @@ declare const pluginClientName = "plugin-client";
436
435
  * })
437
436
  * ```
438
437
  */
439
- declare const pluginClient: (options?: Options | undefined) => _$_kubb_core0.UserPluginWithLifeCycle<PluginClient>;
440
- //#endregion
441
- //#region src/presets.d.ts
442
- /**
443
- * Built-in preset registry for `@kubb/plugin-client`.
444
- *
445
- * - `default` — uses `resolverClient` with v5 naming conventions.
446
- * - `kubbV4` — uses `resolverClientLegacy` with backward-compatible naming.
447
- *
448
- * Note: Unlike plugin-ts/plugin-zod, generators are not defined here because
449
- * plugin-client selects generators dynamically based on `clientType`, `group`,
450
- * and `operations` options. Generator selection happens in `plugin.ts`.
451
- */
452
- declare const presets: _$_kubb_core0.Presets<ResolverClient>;
438
+ declare const pluginClient: (options?: Options | undefined) => _$_kubb_core0.HookStylePlugin<PluginClient>;
453
439
  //#endregion
454
440
  //#region src/resolvers/resolverClient.d.ts
455
441
  /**
@@ -481,5 +467,5 @@ declare const resolverClient: ResolverClient;
481
467
  */
482
468
  declare const resolverClientLegacy: ResolverClient;
483
469
  //#endregion
484
- export { Client, type ClientImportPath, ClientLegacy, type PluginClient, type ResolverClient, UrlLegacy, classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, pluginClient, pluginClientName, presets, resolverClient, resolverClientLegacy, staticClassClientGenerator };
470
+ export { Client, type ClientImportPath, ClientLegacy, type PluginClient, type ResolverClient, UrlLegacy, classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, pluginClient, pluginClientName, resolverClient, resolverClientLegacy, staticClassClientGenerator };
485
471
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -3,10 +3,9 @@ import { source } from "./templates/clients/axios.source.js";
3
3
  import { source as source$1 } from "./templates/clients/fetch.source.js";
4
4
  import { source as source$2 } from "./templates/config.source.js";
5
5
  import path from "node:path";
6
- import { caseParams, createFile, createFunctionParameter, createOperationParams, createParamsType, createSource, createText } from "@kubb/ast";
7
- import { FunctionParams, createPlugin, defineGenerator, definePresets, defineResolver, getPreset, mergeGenerators } from "@kubb/core";
6
+ import { FunctionParams, ast, defineGenerator, definePlugin, defineResolver } from "@kubb/core";
8
7
  import { functionPrinter, pluginTsName } from "@kubb/plugin-ts";
9
- import { Const, File, Function as Function$1 } from "@kubb/renderer-jsx";
8
+ import { Const, File, Function as Function$1, jsxRenderer } from "@kubb/renderer-jsx";
10
9
  import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
11
10
  import { pluginZodName } from "@kubb/plugin-zod";
12
11
  //#region ../../internals/utils/src/casing.ts
@@ -318,11 +317,12 @@ function buildReturnStatement({ dataReturnType, parser, node, zodResolver }) {
318
317
  //#region src/components/Url.tsx
319
318
  const declarationPrinter$3 = functionPrinter({ mode: "declaration" });
320
319
  function getParams$2({ paramsType, paramsCasing, pathParamsType, node, tsResolver }) {
321
- return createOperationParams({
320
+ const urlNode = {
322
321
  ...node,
323
322
  parameters: node.parameters.filter((p) => p.in === "path"),
324
323
  requestBody: void 0
325
- }, {
324
+ };
325
+ return ast.createOperationParams(urlNode, {
326
326
  paramsType: paramsType === "object" ? "object" : "inline",
327
327
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
328
328
  paramsCasing,
@@ -341,7 +341,7 @@ function Url({ name, isExportable = true, isIndexable = true, baseURL, paramsTyp
341
341
  });
342
342
  const paramsSignature = declarationPrinter$3.print(paramsNode) ?? "";
343
343
  const originalPathParams = node.parameters.filter((p) => p.in === "path");
344
- const casedPathParams = caseParams(originalPathParams, paramsCasing);
344
+ const casedPathParams = ast.caseParams(originalPathParams, paramsCasing);
345
345
  const pathParamsMapping = paramsCasing ? buildParamsMapping(originalPathParams, casedPathParams) : void 0;
346
346
  return /* @__PURE__ */ jsx(File.Source, {
347
347
  name,
@@ -370,14 +370,14 @@ Url.getParams = getParams$2;
370
370
  const declarationPrinter$2 = functionPrinter({ mode: "declaration" });
371
371
  function getParams$1({ paramsType, paramsCasing, pathParamsType, node, tsResolver, isConfigurable }) {
372
372
  const requestName = node.requestBody?.schema ? tsResolver.resolveDataName(node) : void 0;
373
- return createOperationParams(node, {
373
+ return ast.createOperationParams(node, {
374
374
  paramsType,
375
375
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
376
376
  paramsCasing,
377
377
  resolver: tsResolver,
378
- extraParams: isConfigurable ? [createFunctionParameter({
378
+ extraParams: isConfigurable ? [ast.createFunctionParameter({
379
379
  name: "config",
380
- type: createParamsType({
380
+ type: ast.createParamsType({
381
381
  variant: "reference",
382
382
  name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
383
383
  }),
@@ -391,11 +391,11 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, bas
391
391
  const contentType = node.requestBody?.contentType ?? "application/json";
392
392
  const isFormData = contentType === "multipart/form-data";
393
393
  const originalPathParams = node.parameters.filter((p) => p.in === "path");
394
- const casedPathParams = caseParams(originalPathParams, paramsCasing);
394
+ const casedPathParams = ast.caseParams(originalPathParams, paramsCasing);
395
395
  const originalQueryParams = node.parameters.filter((p) => p.in === "query");
396
- const casedQueryParams = caseParams(originalQueryParams, paramsCasing);
396
+ const casedQueryParams = ast.caseParams(originalQueryParams, paramsCasing);
397
397
  const originalHeaderParams = node.parameters.filter((p) => p.in === "header");
398
- const casedHeaderParams = caseParams(originalHeaderParams, paramsCasing);
398
+ const casedHeaderParams = ast.caseParams(originalHeaderParams, paramsCasing);
399
399
  const pathParamsMapping = paramsCasing && !urlName ? buildParamsMapping(originalPathParams, casedPathParams) : void 0;
400
400
  const queryParamsMapping = paramsCasing ? buildParamsMapping(originalQueryParams, casedQueryParams) : void 0;
401
401
  const headerParamsMapping = paramsCasing ? buildParamsMapping(originalHeaderParams, casedHeaderParams) : void 0;
@@ -866,10 +866,11 @@ function resolveZodImportNames$1(node, zodResolver) {
866
866
  __name(resolveZodImportNames$1, "resolveZodImportNames");
867
867
  const classClientGenerator = defineGenerator({
868
868
  name: "classClient",
869
- operations(nodes, options) {
870
- const { adapter, config, driver, resolver, root } = this;
871
- const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, wrapper } = options;
872
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL;
869
+ renderer: jsxRenderer,
870
+ operations(nodes, ctx) {
871
+ const { adapter, config, driver, resolver, root } = ctx;
872
+ const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, wrapper } = ctx.options;
873
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL;
873
874
  const pluginTs = driver.getPlugin(pluginTsName);
874
875
  if (!pluginTs?.resolver) return null;
875
876
  const tsResolver = pluginTs.resolver;
@@ -1136,16 +1137,17 @@ const classClientGenerator = defineGenerator({
1136
1137
  //#region src/generators/clientGenerator.tsx
1137
1138
  const clientGenerator = defineGenerator({
1138
1139
  name: "client",
1139
- operation(node, options) {
1140
- const { adapter, config, driver, resolver, root } = this;
1141
- const { output, urlType, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, group } = options;
1142
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL;
1140
+ renderer: jsxRenderer,
1141
+ operation(node, ctx) {
1142
+ const { adapter, config, driver, resolver, root } = ctx;
1143
+ const { output, urlType, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, group } = ctx.options;
1144
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL;
1143
1145
  const pluginTs = driver.getPlugin(pluginTsName);
1144
1146
  if (!pluginTs?.resolver) return null;
1145
1147
  const tsResolver = pluginTs.resolver;
1146
1148
  const pluginZod = parser === "zod" ? driver.getPlugin(pluginZodName) : void 0;
1147
1149
  const zodResolver = pluginZod?.resolver;
1148
- const casedParams = caseParams(node.parameters, paramsCasing);
1150
+ const casedParams = ast.caseParams(node.parameters, paramsCasing);
1149
1151
  const pathParams = casedParams.filter((p) => p.in === "path");
1150
1152
  const queryParams = casedParams.filter((p) => p.in === "query");
1151
1153
  const headerParams = casedParams.filter((p) => p.in === "header");
@@ -1279,9 +1281,10 @@ const clientGenerator = defineGenerator({
1279
1281
  //#region src/generators/groupedClientGenerator.tsx
1280
1282
  const groupedClientGenerator = defineGenerator({
1281
1283
  name: "groupedClient",
1282
- operations(nodes, options) {
1283
- const { config, resolver, adapter, root } = this;
1284
- const { output, group } = options;
1284
+ renderer: jsxRenderer,
1285
+ operations(nodes, ctx) {
1286
+ const { config, resolver, adapter, root } = ctx;
1287
+ const { output, group } = ctx.options;
1285
1288
  return /* @__PURE__ */ jsx(Fragment, { children: nodes.reduce((acc, operationNode) => {
1286
1289
  if (group?.type === "tag") {
1287
1290
  const tag = operationNode.tags[0];
@@ -1375,9 +1378,10 @@ function Operations({ name, nodes }) {
1375
1378
  //#region src/generators/operationsGenerator.tsx
1376
1379
  const operationsGenerator = defineGenerator({
1377
1380
  name: "client",
1378
- operations(nodes, options) {
1379
- const { config, resolver, adapter, root } = this;
1380
- const { output, group } = options;
1381
+ renderer: jsxRenderer,
1382
+ operations(nodes, ctx) {
1383
+ const { config, resolver, adapter, root } = ctx;
1384
+ const { output, group } = ctx.options;
1381
1385
  const name = "operations";
1382
1386
  const file = resolver.resolveFile({
1383
1387
  name,
@@ -1492,10 +1496,11 @@ function resolveZodImportNames(node, zodResolver) {
1492
1496
  }
1493
1497
  const staticClassClientGenerator = defineGenerator({
1494
1498
  name: "staticClassClient",
1495
- operations(nodes, options) {
1496
- const { adapter, config, driver, resolver, root } = this;
1497
- const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath } = options;
1498
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL;
1499
+ renderer: jsxRenderer,
1500
+ operations(nodes, ctx) {
1501
+ const { adapter, config, driver, resolver, root } = ctx;
1502
+ const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath } = ctx.options;
1503
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL;
1499
1504
  const pluginTs = driver.getPlugin(pluginTsName);
1500
1505
  if (!pluginTs?.resolver) return null;
1501
1506
  const tsResolver = pluginTs.resolver;
@@ -1714,9 +1719,6 @@ const staticClassClientGenerator = defineGenerator({
1714
1719
  }
1715
1720
  });
1716
1721
  //#endregion
1717
- //#region package.json
1718
- var version = "5.0.0-alpha.34";
1719
- //#endregion
1720
1722
  //#region src/resolvers/resolverClient.ts
1721
1723
  /**
1722
1724
  * Resolver for `@kubb/plugin-client` that provides the default naming
@@ -1765,28 +1767,6 @@ const resolverClientLegacy = defineResolver(() => ({
1765
1767
  }
1766
1768
  }));
1767
1769
  //#endregion
1768
- //#region src/presets.ts
1769
- /**
1770
- * Built-in preset registry for `@kubb/plugin-client`.
1771
- *
1772
- * - `default` — uses `resolverClient` with v5 naming conventions.
1773
- * - `kubbV4` — uses `resolverClientLegacy` with backward-compatible naming.
1774
- *
1775
- * Note: Unlike plugin-ts/plugin-zod, generators are not defined here because
1776
- * plugin-client selects generators dynamically based on `clientType`, `group`,
1777
- * and `operations` options. Generator selection happens in `plugin.ts`.
1778
- */
1779
- const presets = definePresets({
1780
- default: {
1781
- name: "default",
1782
- resolver: resolverClient
1783
- },
1784
- kubbV4: {
1785
- name: "kubbV4",
1786
- resolver: resolverClientLegacy
1787
- }
1788
- });
1789
- //#endregion
1790
1770
  //#region src/plugin.ts
1791
1771
  /**
1792
1772
  * Canonical plugin name for `@kubb/plugin-client`, used to identify the plugin
@@ -1809,37 +1789,35 @@ const pluginClientName = "plugin-client";
1809
1789
  * })
1810
1790
  * ```
1811
1791
  */
1812
- const pluginClient = createPlugin((options) => {
1792
+ const pluginClient = definePlugin((options) => {
1813
1793
  const { output = {
1814
1794
  path: "clients",
1815
1795
  barrelType: "named"
1816
- }, group, exclude = [], include, override = [], urlType = false, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, bundle = false, wrapper, baseURL, compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer } = options;
1796
+ }, group, exclude = [], include, override = [], urlType = false, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, bundle = false, wrapper, baseURL, resolver: userResolver, transformer: userTransformer, compatibilityPreset = "default" } = options;
1797
+ const defaultResolver = compatibilityPreset === "kubbV4" ? resolverClientLegacy : resolverClient;
1817
1798
  const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
1818
- const preset = getPreset({
1819
- preset: compatibilityPreset,
1820
- presets,
1821
- resolver: userResolver,
1822
- transformer: userTransformer,
1823
- generators: options.generators ?? [
1824
- clientType === "staticClass" ? staticClassClientGenerator : clientType === "class" ? classClientGenerator : clientGenerator,
1825
- group && clientType === "function" ? groupedClientGenerator : void 0,
1826
- operations ? operationsGenerator : void 0
1827
- ].filter((x) => Boolean(x))
1828
- });
1829
- const mergedGenerator = mergeGenerators(preset.generators ?? []);
1830
- let resolveNameWarning = false;
1831
- let resolvePathWarning = false;
1799
+ const selectedGenerators = options.generators ?? [
1800
+ clientType === "staticClass" ? staticClassClientGenerator : clientType === "class" ? classClientGenerator : clientGenerator,
1801
+ group && clientType === "function" ? groupedClientGenerator : void 0,
1802
+ operations ? operationsGenerator : void 0
1803
+ ].filter((x) => Boolean(x));
1804
+ const groupConfig = group ? {
1805
+ ...group,
1806
+ name: group.name ? group.name : (ctx) => {
1807
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
1808
+ return `${camelCase(ctx.group)}Controller`;
1809
+ }
1810
+ } : void 0;
1832
1811
  return {
1833
1812
  name: pluginClientName,
1834
- version,
1835
- get resolver() {
1836
- return preset.resolver;
1837
- },
1838
- get transformer() {
1839
- return preset.transformer;
1840
- },
1841
- get options() {
1842
- return {
1813
+ options,
1814
+ dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
1815
+ hooks: { "kubb:plugin:setup"(ctx) {
1816
+ const resolver = userResolver ? {
1817
+ ...defaultResolver,
1818
+ ...userResolver
1819
+ } : defaultResolver;
1820
+ ctx.setOptions({
1843
1821
  client,
1844
1822
  clientType,
1845
1823
  bundle,
@@ -1847,13 +1825,7 @@ const pluginClient = createPlugin((options) => {
1847
1825
  exclude,
1848
1826
  include,
1849
1827
  override,
1850
- group: group ? {
1851
- ...group,
1852
- name: group.name ? group.name : (ctx) => {
1853
- if (group.type === "path") return `${ctx.group.split("/")[1]}`;
1854
- return `${camelCase(ctx.group)}Controller`;
1855
- }
1856
- } : void 0,
1828
+ group: groupConfig,
1857
1829
  parser,
1858
1830
  dataReturnType,
1859
1831
  importPath: resolvedImportPath,
@@ -1863,66 +1835,36 @@ const pluginClient = createPlugin((options) => {
1863
1835
  pathParamsType,
1864
1836
  urlType,
1865
1837
  wrapper,
1866
- resolver: preset.resolver
1867
- };
1868
- },
1869
- pre: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
1870
- resolvePath(baseName, pathMode, options) {
1871
- if (!resolvePathWarning) {
1872
- this.warn("Do not use resolvePath for pluginClient, use resolverClient.resolvePath instead");
1873
- resolvePathWarning = true;
1874
- }
1875
- return this.plugin.resolver.resolvePath({
1876
- baseName,
1877
- pathMode,
1878
- tag: options?.group?.tag,
1879
- path: options?.group?.path
1880
- }, {
1881
- root: this.root,
1882
- output,
1883
- group: this.plugin.options.group
1838
+ resolver
1884
1839
  });
1885
- },
1886
- resolveName(name, type) {
1887
- if (!resolveNameWarning) {
1888
- this.warn("Do not use resolveName for pluginClient, use resolverClient.default instead");
1889
- resolveNameWarning = true;
1890
- }
1891
- return this.plugin.resolver.default(name, type);
1892
- },
1893
- async operation(node, options) {
1894
- return mergedGenerator.operation?.call(this, node, options);
1895
- },
1896
- async operations(nodes, options) {
1897
- return mergedGenerator.operations?.call(this, nodes, options);
1898
- },
1899
- async buildStart() {
1900
- const { plugin } = this;
1901
- const root = this.root;
1902
- if (bundle && !plugin.options.importPath) await this.addFile(createFile({
1840
+ ctx.setResolver(resolver);
1841
+ if (userTransformer) ctx.setTransformer(userTransformer);
1842
+ for (const gen of selectedGenerators) ctx.addGenerator(gen);
1843
+ const root = path.resolve(ctx.config.root, ctx.config.output.path);
1844
+ if (bundle && !resolvedImportPath) ctx.injectFile({
1903
1845
  baseName: "fetch.ts",
1904
1846
  path: path.resolve(root, ".kubb/fetch.ts"),
1905
- sources: [createSource({
1847
+ sources: [ast.createSource({
1906
1848
  name: "fetch",
1907
- nodes: [createText(plugin.options.client === "fetch" ? source$1 : source)],
1849
+ nodes: [ast.createText(client === "fetch" ? source$1 : source)],
1908
1850
  isExportable: true,
1909
1851
  isIndexable: true
1910
1852
  })]
1911
- }));
1912
- await this.addFile(createFile({
1853
+ });
1854
+ ctx.injectFile({
1913
1855
  baseName: "config.ts",
1914
1856
  path: path.resolve(root, ".kubb/config.ts"),
1915
- sources: [createSource({
1857
+ sources: [ast.createSource({
1916
1858
  name: "config",
1917
- nodes: [createText(source$2)],
1859
+ nodes: [ast.createText(source$2)],
1918
1860
  isExportable: false,
1919
1861
  isIndexable: false
1920
1862
  })]
1921
- }));
1922
- }
1863
+ });
1864
+ } }
1923
1865
  };
1924
1866
  });
1925
1867
  //#endregion
1926
- export { Client, ClientLegacy, UrlLegacy, classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, pluginClient, pluginClientName, presets, resolverClient, resolverClientLegacy, staticClassClientGenerator };
1868
+ export { Client, ClientLegacy, UrlLegacy, classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, pluginClient, pluginClientName, resolverClient, resolverClientLegacy, staticClassClientGenerator };
1927
1869
 
1928
1870
  //# sourceMappingURL=index.js.map