@kubb/plugin-vue-query 3.16.1 → 3.16.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.
Files changed (39) hide show
  1. package/dist/components-ClNrCCre.cjs +873 -0
  2. package/dist/components-ClNrCCre.cjs.map +1 -0
  3. package/dist/components-D8lYnxao.js +803 -0
  4. package/dist/components-D8lYnxao.js.map +1 -0
  5. package/dist/components.cjs +9 -36
  6. package/dist/components.d.cts +266 -124
  7. package/dist/components.d.ts +266 -124
  8. package/dist/components.js +3 -3
  9. package/dist/generators-DIB6YtRr.js +556 -0
  10. package/dist/generators-DIB6YtRr.js.map +1 -0
  11. package/dist/generators-DIZQUvkg.cjs +573 -0
  12. package/dist/generators-DIZQUvkg.cjs.map +1 -0
  13. package/dist/generators.cjs +5 -20
  14. package/dist/generators.d.cts +12 -12
  15. package/dist/generators.d.ts +12 -12
  16. package/dist/generators.js +4 -4
  17. package/dist/index.cjs +118 -143
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +6 -8
  20. package/dist/index.d.ts +6 -8
  21. package/dist/index.js +118 -137
  22. package/dist/index.js.map +1 -1
  23. package/dist/types-DPDni0p-.d.ts +1385 -0
  24. package/dist/types-UcJcIqHK.d.cts +1385 -0
  25. package/package.json +25 -30
  26. package/dist/chunk-5RO5VZAJ.js +0 -444
  27. package/dist/chunk-5RO5VZAJ.js.map +0 -1
  28. package/dist/chunk-BBSHBY5N.cjs +0 -448
  29. package/dist/chunk-BBSHBY5N.cjs.map +0 -1
  30. package/dist/chunk-KHEXOVSW.js +0 -726
  31. package/dist/chunk-KHEXOVSW.js.map +0 -1
  32. package/dist/chunk-ZR7DRLPY.cjs +0 -734
  33. package/dist/chunk-ZR7DRLPY.cjs.map +0 -1
  34. package/dist/components.cjs.map +0 -1
  35. package/dist/components.js.map +0 -1
  36. package/dist/generators.cjs.map +0 -1
  37. package/dist/generators.js.map +0 -1
  38. package/dist/types-CDzVWC17.d.cts +0 -164
  39. package/dist/types-CDzVWC17.d.ts +0 -164
package/dist/index.js CHANGED
@@ -1,142 +1,123 @@
1
- import { queryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-5RO5VZAJ.js';
2
- import { MutationKey, QueryKey } from './chunk-KHEXOVSW.js';
3
- import path from 'path';
4
- import { createPlugin, PluginManager, FileManager } from '@kubb/core';
5
- import { camelCase, pascalCase } from '@kubb/core/transformers';
6
- import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
7
- import { pluginTsName } from '@kubb/plugin-ts';
8
- import { pluginZodName } from '@kubb/plugin-zod';
1
+ import { MutationKey, QueryKey } from "./components-D8lYnxao.js";
2
+ import { infiniteQueryGenerator, mutationGenerator, queryGenerator } from "./generators-DIB6YtRr.js";
3
+ import path from "node:path";
4
+ import { FileManager, PluginManager, createPlugin } from "@kubb/core";
5
+ import { camelCase, pascalCase } from "@kubb/core/transformers";
6
+ import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
7
+ import { pluginTsName } from "@kubb/plugin-ts";
8
+ import { pluginZodName } from "@kubb/plugin-zod";
9
9
 
10
- var pluginVueQueryName = "plugin-vue-query";
11
- var pluginVueQuery = createPlugin((options) => {
12
- const {
13
- output = { path: "hooks", barrelType: "named" },
14
- group,
15
- exclude = [],
16
- include,
17
- override = [],
18
- parser = "client",
19
- infinite,
20
- transformers = {},
21
- paramsType = "inline",
22
- pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline",
23
- mutation = {},
24
- query = {},
25
- paramsCasing,
26
- mutationKey = MutationKey.getTransformer,
27
- queryKey = QueryKey.getTransformer,
28
- generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),
29
- contentType
30
- } = options;
31
- return {
32
- name: pluginVueQueryName,
33
- options: {
34
- output,
35
- client: {
36
- importPath: "@kubb/plugin-client/clients/axios",
37
- dataReturnType: "data",
38
- pathParamsType,
39
- ...options.client
40
- },
41
- infinite: infinite ? {
42
- queryParam: "id",
43
- initialPageParam: 0,
44
- cursorParam: void 0,
45
- ...infinite
46
- } : false,
47
- queryKey,
48
- query: query === false ? false : {
49
- methods: ["get"],
50
- importPath: "@tanstack/vue-query",
51
- ...query
52
- },
53
- mutationKey,
54
- mutation: {
55
- methods: ["post", "put", "patch", "delete"],
56
- importPath: "@tanstack/vue-query",
57
- ...mutation
58
- },
59
- paramsType,
60
- pathParamsType,
61
- parser,
62
- paramsCasing,
63
- group
64
- },
65
- pre: [pluginOasName, pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
66
- resolvePath(baseName, pathMode, options2) {
67
- const root = path.resolve(this.config.root, this.config.output.path);
68
- const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
69
- if (mode === "single") {
70
- return path.resolve(root, output.path);
71
- }
72
- if (group && (options2?.group?.path || options2?.group?.tag)) {
73
- const groupName = group?.name ? group.name : (ctx) => {
74
- if (group?.type === "path") {
75
- return `${ctx.group.split("/")[1]}`;
76
- }
77
- return `${camelCase(ctx.group)}Controller`;
78
- };
79
- return path.resolve(
80
- root,
81
- output.path,
82
- groupName({
83
- group: group.type === "path" ? options2.group.path : options2.group.tag
84
- }),
85
- baseName
86
- );
87
- }
88
- return path.resolve(root, output.path, baseName);
89
- },
90
- resolveName(name, type) {
91
- let resolvedName = camelCase(name);
92
- if (type === "file" || type === "function") {
93
- resolvedName = camelCase(name, {
94
- isFile: type === "file"
95
- });
96
- }
97
- if (type === "type") {
98
- resolvedName = pascalCase(name);
99
- }
100
- if (type) {
101
- return transformers?.name?.(resolvedName, type) || resolvedName;
102
- }
103
- return resolvedName;
104
- },
105
- async buildStart() {
106
- const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
107
- const oas = await swaggerPlugin.context.getOas();
108
- const root = path.resolve(this.config.root, this.config.output.path);
109
- const mode = FileManager.getMode(path.resolve(root, output.path));
110
- const baseURL = await swaggerPlugin.context.getBaseURL();
111
- if (baseURL) {
112
- this.plugin.options.client.baseURL = baseURL;
113
- }
114
- const operationGenerator = new OperationGenerator(this.plugin.options, {
115
- oas,
116
- pluginManager: this.pluginManager,
117
- plugin: this.plugin,
118
- contentType,
119
- exclude,
120
- include,
121
- override,
122
- mode
123
- });
124
- const files = await operationGenerator.build(...generators);
125
- await this.addFile(...files);
126
- const barrelFiles = await this.fileManager.getBarrelFiles({
127
- type: output.barrelType ?? "named",
128
- root,
129
- output,
130
- meta: {
131
- pluginKey: this.plugin.key
132
- },
133
- logger: this.logger
134
- });
135
- await this.addFile(...barrelFiles);
136
- }
137
- };
10
+ //#region src/plugin.ts
11
+ const pluginVueQueryName = "plugin-vue-query";
12
+ const pluginVueQuery = createPlugin((options) => {
13
+ const { output = {
14
+ path: "hooks",
15
+ barrelType: "named"
16
+ }, group, exclude = [], include, override = [], parser = "client", infinite, transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, paramsCasing, mutationKey = MutationKey.getTransformer, queryKey = QueryKey.getTransformer, generators = [
17
+ queryGenerator,
18
+ infiniteQueryGenerator,
19
+ mutationGenerator
20
+ ].filter(Boolean), contentType } = options;
21
+ return {
22
+ name: pluginVueQueryName,
23
+ options: {
24
+ output,
25
+ client: {
26
+ importPath: "@kubb/plugin-client/clients/axios",
27
+ dataReturnType: "data",
28
+ pathParamsType,
29
+ ...options.client
30
+ },
31
+ infinite: infinite ? {
32
+ queryParam: "id",
33
+ initialPageParam: 0,
34
+ cursorParam: void 0,
35
+ ...infinite
36
+ } : false,
37
+ queryKey,
38
+ query: query === false ? false : {
39
+ methods: ["get"],
40
+ importPath: "@tanstack/vue-query",
41
+ ...query
42
+ },
43
+ mutationKey,
44
+ mutation: {
45
+ methods: [
46
+ "post",
47
+ "put",
48
+ "patch",
49
+ "delete"
50
+ ],
51
+ importPath: "@tanstack/vue-query",
52
+ ...mutation
53
+ },
54
+ paramsType,
55
+ pathParamsType,
56
+ parser,
57
+ paramsCasing,
58
+ group
59
+ },
60
+ pre: [
61
+ pluginOasName,
62
+ pluginTsName,
63
+ parser === "zod" ? pluginZodName : void 0
64
+ ].filter(Boolean),
65
+ resolvePath(baseName, pathMode, options$1) {
66
+ const root = path.resolve(this.config.root, this.config.output.path);
67
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
68
+ if (mode === "single")
69
+ /**
70
+ * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
71
+ * Other plugins then need to call addOrAppend instead of just add from the fileManager class
72
+ */
73
+ return path.resolve(root, output.path);
74
+ if (group && (options$1?.group?.path || options$1?.group?.tag)) {
75
+ const groupName = group?.name ? group.name : (ctx) => {
76
+ if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
77
+ return `${camelCase(ctx.group)}Controller`;
78
+ };
79
+ return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
80
+ }
81
+ return path.resolve(root, output.path, baseName);
82
+ },
83
+ resolveName(name, type) {
84
+ let resolvedName = camelCase(name);
85
+ if (type === "file" || type === "function") resolvedName = camelCase(name, { isFile: type === "file" });
86
+ if (type === "type") resolvedName = pascalCase(name);
87
+ if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
88
+ return resolvedName;
89
+ },
90
+ async buildStart() {
91
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
92
+ const oas = await swaggerPlugin.context.getOas();
93
+ const root = path.resolve(this.config.root, this.config.output.path);
94
+ const mode = FileManager.getMode(path.resolve(root, output.path));
95
+ const baseURL = await swaggerPlugin.context.getBaseURL();
96
+ if (baseURL) this.plugin.options.client.baseURL = baseURL;
97
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
98
+ oas,
99
+ pluginManager: this.pluginManager,
100
+ plugin: this.plugin,
101
+ contentType,
102
+ exclude,
103
+ include,
104
+ override,
105
+ mode
106
+ });
107
+ const files = await operationGenerator.build(...generators);
108
+ await this.addFile(...files);
109
+ const barrelFiles = await this.fileManager.getBarrelFiles({
110
+ type: output.barrelType ?? "named",
111
+ root,
112
+ output,
113
+ meta: { pluginKey: this.plugin.key },
114
+ logger: this.logger
115
+ });
116
+ await this.addFile(...barrelFiles);
117
+ }
118
+ };
138
119
  });
139
120
 
121
+ //#endregion
140
122
  export { pluginVueQuery, pluginVueQueryName };
141
- //# sourceMappingURL=index.js.map
142
123
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;AAeO,IAAM,kBAAqB,GAAA;AAErB,IAAA,cAAA,GAAiB,YAA6B,CAAA,CAAC,OAAY,KAAA;AACtE,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,QAAA;AAAA,IACA,eAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,UAAA,KAAe,QAAW,GAAA,QAAA,GAAW,QAAQ,cAAkB,IAAA,QAAA;AAAA,IAChF,WAAW,EAAC;AAAA,IACZ,QAAQ,EAAC;AAAA,IACT,YAAA;AAAA,IACA,cAAc,WAAY,CAAA,cAAA;AAAA,IAC1B,WAAW,QAAS,CAAA,cAAA;AAAA,IACpB,aAAa,CAAC,cAAA,EAAgB,wBAAwB,iBAAiB,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IACvF;AAAA,GACE,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,kBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,UAAY,EAAA,mCAAA;AAAA,QACZ,cAAgB,EAAA,MAAA;AAAA,QAChB,cAAA;AA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A,MAAA;AAAA,QACA,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { MutationKey, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.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)}Controller`\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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\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<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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 = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 this.fileManager.getBarrelFiles({\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"]}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { MutationKey, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.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)}Controller`\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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\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<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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 = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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 this.fileManager.getBarrelFiles({\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":";;;;;;;;;;AAeA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,aAA6B,CAAC,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;CAAS,GAC/C,OACA,UAAU,CAAE,GACZ,SACA,WAAW,CAAE,GACb,SAAS,UACT,UACA,eAAe,CAAE,GACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,CAAE,GACb,QAAQ,CAAE,GACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa;EAAC;EAAgB;EAAwB;CAAkB,EAAC,OAAO,QAAQ,EACxF,aACD,GAAG;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB;IACA,GAAG,QAAQ;GACZ;GACD,UAAU,WACN;IACE,YAAY;IACZ,kBAAkB;IAClB,aAAa;IACb,GAAG;GACJ,IACD;GACJ;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,KAAM;IAChB,YAAY;IACZ,GAAG;GACJ;GACP;GACA,UAAU;IACR,SAAS;KAAC;KAAQ;KAAO;KAAS;IAAS;IAC3C,YAAY;IACZ,GAAG;GACJ;GACD;GACA;GACA;GACA;GACA;EACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,QAAQ,gBAAgB;EAAU,EAAC,OAAO,QAAQ;EAChG,YAAY,UAAU,UAAUA,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,YAAY,YAAY,QAAQ,KAAK,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