@kubb/plugin-react-query 5.8.0-canary.20261027T170749 → 5.8.0-canary.20261027T172409

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.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region \0rolldown/runtime.js
5
+ // \0rolldown/runtime.js
6
6
  var __create = Object.create;
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  value: mod,
24
24
  enumerable: true
25
25
  }) : target, mod));
26
- //#endregion
27
26
  let kubb_kit = require("kubb/kit");
28
27
  let node_path = require("node:path");
29
28
  node_path = __toESM(node_path, 1);
@@ -33,7 +32,7 @@ let _kubb_plugin_ts = require("@kubb/plugin-ts");
33
32
  let kubb_jsx_jsx_runtime = require("kubb/jsx/jsx-runtime");
34
33
  let node_fs = require("node:fs");
35
34
  node_fs = __toESM(node_fs, 1);
36
- //#region ../../internals/shared/src/operation.ts
35
+ // ../../internals/shared/src/operation.ts
37
36
  /**
38
37
  * Builds the `ResolverFileParams` every operation generator passes to
39
38
  * `resolver.file`: a file named `name`, tagged by the operation's first
@@ -289,8 +288,7 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
289
288
  byResolver.set(cacheKey, result);
290
289
  return result;
291
290
  }
292
- //#endregion
293
- //#region ../../internals/utils/src/casing.ts
291
+ // ../../internals/utils/src/casing.ts
294
292
  /**
295
293
  * Shared implementation for camelCase and PascalCase conversion.
296
294
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -337,8 +335,7 @@ function camelCase(text, { prefix = "", suffix = "" } = {}) {
337
335
  function capitalize(text) {
338
336
  return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
339
337
  }
340
- //#endregion
341
- //#region ../../internals/utils/src/reserved.ts
338
+ // ../../internals/utils/src/reserved.ts
342
339
  /**
343
340
  * JavaScript and Java reserved words.
344
341
  * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
@@ -477,8 +474,7 @@ function ensureValidVarName(name) {
477
474
  function isIdentifier(name) {
478
475
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
479
476
  }
480
- //#endregion
481
- //#region ../../internals/utils/src/strings.ts
477
+ // ../../internals/utils/src/strings.ts
482
478
  /**
483
479
  * Renders a dotted path or string array as an optional-chaining accessor expression rooted at
484
480
  * `accessor`. Returns `null` for an empty path.
@@ -494,8 +490,7 @@ function getNestedAccessor(param, accessor) {
494
490
  if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
495
491
  return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
496
492
  }
497
- //#endregion
498
- //#region ../../internals/shared/src/resolver.ts
493
+ // ../../internals/shared/src/resolver.ts
499
494
  function resolveOperationName(name) {
500
495
  return ensureValidVarName(camelCase(name));
501
496
  }
@@ -517,8 +512,7 @@ function operationKey(node, ...scope) {
517
512
  ...scope.map(String)
518
513
  ];
519
514
  }
520
- //#endregion
521
- //#region ../../internals/shared/src/group.ts
515
+ // ../../internals/shared/src/group.ts
522
516
  /**
523
517
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
524
518
  * shared default naming so every plugin groups output consistently:
@@ -548,17 +542,14 @@ function createGroupConfig(group) {
548
542
  name: group.name ? group.name : defaultName
549
543
  };
550
544
  }
551
- //#endregion
552
- //#region kubb-extension.json
545
+ // kubb-extension.json
553
546
  var compatibility = {
554
547
  "kubb": ">=5.14.6",
555
548
  "node": ">=22.22"
556
549
  };
557
- //#endregion
558
- //#region package.json
559
- var version = "5.8.0-canary.20261027T170749";
560
- //#endregion
561
- //#region ../../internals/client/src/resolveOperationTypes.ts
550
+ // package.json
551
+ var version = "5.8.0-canary.20261027T172409";
552
+ // ../../internals/client/src/resolveOperationTypes.ts
562
553
  /**
563
554
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
564
555
  * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.
@@ -624,8 +615,7 @@ function resolveOperationTypes(driver, pluginName) {
624
615
  group: pluginZod.options.group ?? void 0
625
616
  };
626
617
  }
627
- //#endregion
628
- //#region ../../internals/client/src/resolveClient.ts
618
+ // ../../internals/client/src/resolveClient.ts
629
619
  /**
630
620
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
631
621
  * operation, shared so the selection rules and diagnostics stay in one place.
@@ -735,8 +725,7 @@ function resolveContractClient(options) {
735
725
  }
736
726
  return resolved;
737
727
  }
738
- //#endregion
739
- //#region ../../internals/client/src/resolveClientOperation.ts
728
+ // ../../internals/client/src/resolveClientOperation.ts
740
729
  function isRelativeImport(importPath) {
741
730
  return importPath.startsWith(".");
742
731
  }
@@ -799,8 +788,7 @@ function resolveClientOperation(options) {
799
788
  };
800
789
  });
801
790
  }
802
- //#endregion
803
- //#region ../../internals/tanstack-query/src/components/HookFile.tsx
791
+ // ../../internals/tanstack-query/src/components/HookFile.tsx
804
792
  /**
805
793
  * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or
806
794
  * `pluginZod({ inferred: 'codec' })`), banner and footer.
@@ -889,8 +877,7 @@ function HookFile({ hook, imports, children }) {
889
877
  ]
890
878
  });
891
879
  }
892
- //#endregion
893
- //#region ../../internals/tanstack-query/src/utils.ts
880
+ // ../../internals/tanstack-query/src/utils.ts
894
881
  /**
895
882
  * The grouped request options, ordered for both the destructured signature and the
896
883
  * call passed to the underlying client.
@@ -1256,8 +1243,7 @@ function buildResolvedRequestParams(node) {
1256
1243
  if (names.length === 0) return null;
1257
1244
  return `{ ${names.map((name) => `${name}: typeof ${name} === 'function' ? ${name}() : ${name}`).join(", ")} }`;
1258
1245
  }
1259
- //#endregion
1260
- //#region ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1246
+ // ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1261
1247
  const declarationPrinter$6 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1262
1248
  const callPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1263
1249
  function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, returnType = "full" }) {
@@ -1333,8 +1319,7 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
1333
1319
  })
1334
1320
  });
1335
1321
  }
1336
- //#endregion
1337
- //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
1322
+ // ../../internals/tanstack-query/src/components/MutationKey.tsx
1338
1323
  const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1339
1324
  /**
1340
1325
  * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
@@ -1381,8 +1366,7 @@ function MutationKey({ name, node, transformer, typeName }) {
1381
1366
  })
1382
1367
  })] });
1383
1368
  }
1384
- //#endregion
1385
- //#region ../../internals/tanstack-query/src/resolver.ts
1369
+ // ../../internals/tanstack-query/src/resolver.ts
1386
1370
  /**
1387
1371
  * Builds the shared query namespace for a variant. Spread the result into
1388
1372
  * `createResolver` once per variant the plugin supports.
@@ -1462,8 +1446,7 @@ function createMutationResolver() {
1462
1446
  }
1463
1447
  };
1464
1448
  }
1465
- //#endregion
1466
- //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
1449
+ // ../../internals/tanstack-query/src/components/QueryKey.tsx
1467
1450
  const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1468
1451
  /**
1469
1452
  * Default `queryKey` builder. Call it from a custom builder to extend the default key.
@@ -1521,8 +1504,7 @@ function QueryKey({ name, node, tsResolver, typeName, transformer, variant = "qu
1521
1504
  })
1522
1505
  })] });
1523
1506
  }
1524
- //#endregion
1525
- //#region src/generators/customHookOptionsFileGenerator.tsx
1507
+ // src/generators/customHookOptionsFileGenerator.tsx
1526
1508
  /**
1527
1509
  * Scaffolds the user-editable `useCustomHookOptions` file when
1528
1510
  * `pluginReactQuery({ customOptions: { ... }, hooks: true })` is configured. The file is
@@ -1619,8 +1601,7 @@ const customHookOptionsFileGenerator = (0, kubb_kit.defineGenerator)({
1619
1601
  });
1620
1602
  }
1621
1603
  });
1622
- //#endregion
1623
- //#region src/generators/hookOptionsGenerator.tsx
1604
+ // src/generators/hookOptionsGenerator.tsx
1624
1605
  /**
1625
1606
  * Emits the `HookOptions` type used by `customOptions`. Enabled when
1626
1607
  * `pluginReactQuery({ customOptions: { ... } })`. The generated type lists
@@ -1779,8 +1760,7 @@ const hookOptionsGenerator = (0, kubb_kit.defineGenerator)({
1779
1760
  });
1780
1761
  }
1781
1762
  });
1782
- //#endregion
1783
- //#region src/components/Query.tsx
1763
+ // src/components/Query.tsx
1784
1764
  const declarationPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1785
1765
  const OBSERVER_OPTIONS_NAMES = {
1786
1766
  infinite: {
@@ -1890,8 +1870,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, t
1890
1870
  })
1891
1871
  });
1892
1872
  }
1893
- //#endregion
1894
- //#region src/components/QueryOptions.tsx
1873
+ // src/components/QueryOptions.tsx
1895
1874
  const declarationPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1896
1875
  const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1897
1876
  function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, returnType = "full" }) {
@@ -1924,8 +1903,7 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
1924
1903
  })
1925
1904
  });
1926
1905
  }
1927
- //#endregion
1928
- //#region src/generators/createQueryGenerator.tsx
1906
+ // src/generators/createQueryGenerator.tsx
1929
1907
  const OBSERVER_IMPORTS = {
1930
1908
  query: ["QueryObserverOptions", "UseQueryResult"],
1931
1909
  suspenseQuery: ["UseSuspenseQueryOptions", "UseSuspenseQueryResult"],
@@ -2084,8 +2062,7 @@ function createQueryGenerator({ name, variant }) {
2084
2062
  }
2085
2063
  });
2086
2064
  }
2087
- //#endregion
2088
- //#region src/generators/infiniteQueryGenerator.tsx
2065
+ // src/generators/infiniteQueryGenerator.tsx
2089
2066
  /**
2090
2067
  * Built-in generator for `useInfiniteQuery` hooks. Enabled when
2091
2068
  * `pluginReactQuery({ infinite: { ... }, hooks: true })`. Emits one
@@ -2097,8 +2074,7 @@ const infiniteQueryGenerator = createQueryGenerator({
2097
2074
  name: "react-infinite-query",
2098
2075
  variant: "infiniteQuery"
2099
2076
  });
2100
- //#endregion
2101
- //#region src/components/MutationOptions.tsx
2077
+ // src/components/MutationOptions.tsx
2102
2078
  const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
2103
2079
  const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
2104
2080
  function buildMutationConfigParamsNode(node) {
@@ -2147,8 +2123,7 @@ function MutationOptions({ name, clientName, node, tsResolver, mutationKeyName,
2147
2123
  })
2148
2124
  });
2149
2125
  }
2150
- //#endregion
2151
- //#region src/components/Mutation.tsx
2126
+ // src/components/Mutation.tsx
2152
2127
  const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
2153
2128
  const callPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
2154
2129
  function buildMutationParamsNode(node, options) {
@@ -2207,8 +2182,7 @@ function Mutation({ name, mutationOptionsName, node, tsResolver, mutationKeyName
2207
2182
  })
2208
2183
  });
2209
2184
  }
2210
- //#endregion
2211
- //#region src/generators/mutationGenerator.tsx
2185
+ // src/generators/mutationGenerator.tsx
2212
2186
  /**
2213
2187
  * Built-in generator for `useMutation` hooks. Emits one `useFooMutation` hook
2214
2188
  * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus
@@ -2301,8 +2275,7 @@ const mutationGenerator = (0, kubb_kit.defineGenerator)({
2301
2275
  });
2302
2276
  }
2303
2277
  });
2304
- //#endregion
2305
- //#region src/generators/queryGenerator.tsx
2278
+ // src/generators/queryGenerator.tsx
2306
2279
  /**
2307
2280
  * Built-in generator for `useQuery` hooks. Emits one `useFooQuery` hook per
2308
2281
  * GET and QUERY operation (configurable via `query.methods`) plus the matching
@@ -2312,8 +2285,7 @@ const queryGenerator = createQueryGenerator({
2312
2285
  name: "react-query",
2313
2286
  variant: "query"
2314
2287
  });
2315
- //#endregion
2316
- //#region src/generators/suspenseInfiniteQueryGenerator.tsx
2288
+ // src/generators/suspenseInfiniteQueryGenerator.tsx
2317
2289
  /**
2318
2290
  * Built-in generator for `useSuspenseInfiniteQuery` hooks. Enabled when
2319
2291
  * `suspense`, `infinite`, and `hooks` are all configured. Combines suspense
@@ -2324,8 +2296,7 @@ const suspenseInfiniteQueryGenerator = createQueryGenerator({
2324
2296
  name: "react-suspense-infinite-query",
2325
2297
  variant: "suspenseInfiniteQuery"
2326
2298
  });
2327
- //#endregion
2328
- //#region src/generators/suspenseQueryGenerator.tsx
2299
+ // src/generators/suspenseQueryGenerator.tsx
2329
2300
  /**
2330
2301
  * Built-in generator for `useSuspenseQuery` hooks. Enabled when
2331
2302
  * `pluginReactQuery({ suspense: {}, hooks: true })`. Emits one
@@ -2337,8 +2308,7 @@ const suspenseQueryGenerator = createQueryGenerator({
2337
2308
  name: "react-suspense-query",
2338
2309
  variant: "suspenseQuery"
2339
2310
  });
2340
- //#endregion
2341
- //#region src/resolvers/resolverReactQuery.ts
2311
+ // src/resolvers/resolverReactQuery.ts
2342
2312
  /**
2343
2313
  * Default resolver used by `@kubb/plugin-react-query`. Decides the names and
2344
2314
  * file paths for every generated TanStack Query hook (`useFoo`,
@@ -2397,8 +2367,7 @@ const resolverReactQuery = (0, kubb_kit.createResolver)({
2397
2367
  }
2398
2368
  }
2399
2369
  });
2400
- //#endregion
2401
- //#region src/plugin.ts
2370
+ // src/plugin.ts
2402
2371
  /**
2403
2372
  * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups
2404
2373
  * and cross-plugin dependency references.
@@ -2472,7 +2441,6 @@ const pluginReactQuery = (0, kubb_kit.defineExtension)({
2472
2441
  };
2473
2442
  }
2474
2443
  });
2475
- //#endregion
2476
2444
  exports.default = pluginReactQuery;
2477
2445
  exports.definePageParam = definePageParam;
2478
2446
  exports.mutationKeyTransformer = mutationKeyTransformer;