@kubb/plugin-faker 5.0.0-alpha.9 → 5.0.0-beta.10

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 (44) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +25 -7
  3. package/dist/Faker-BMgoFj8b.d.ts +27 -0
  4. package/dist/Faker-CWtonujy.js +334 -0
  5. package/dist/Faker-CWtonujy.js.map +1 -0
  6. package/dist/Faker-D39THFJ-.cjs +418 -0
  7. package/dist/Faker-D39THFJ-.cjs.map +1 -0
  8. package/dist/components.cjs +2 -2
  9. package/dist/components.d.ts +2 -31
  10. package/dist/components.js +1 -1
  11. package/dist/fakerGenerator-B-QnVz9o.d.ts +9 -0
  12. package/dist/fakerGenerator-B-XuVREg.cjs +570 -0
  13. package/dist/fakerGenerator-B-XuVREg.cjs.map +1 -0
  14. package/dist/fakerGenerator-DH6hN3yb.js +560 -0
  15. package/dist/fakerGenerator-DH6hN3yb.js.map +1 -0
  16. package/dist/generators.cjs +1 -1
  17. package/dist/generators.d.ts +2 -505
  18. package/dist/generators.js +1 -1
  19. package/dist/index.cjs +237 -84
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.ts +28 -4
  22. package/dist/index.js +229 -83
  23. package/dist/index.js.map +1 -1
  24. package/dist/printerFaker-W0pLunAj.d.ts +213 -0
  25. package/extension.yaml +357 -0
  26. package/package.json +48 -51
  27. package/src/components/Faker.tsx +124 -78
  28. package/src/generators/fakerGenerator.tsx +233 -134
  29. package/src/index.ts +7 -2
  30. package/src/plugin.ts +60 -121
  31. package/src/printers/printerFaker.ts +341 -0
  32. package/src/resolvers/resolverFaker.ts +85 -0
  33. package/src/types.ts +134 -81
  34. package/src/utils.ts +268 -0
  35. package/dist/components-BkBIov4R.js +0 -419
  36. package/dist/components-BkBIov4R.js.map +0 -1
  37. package/dist/components-IdP8GXXX.cjs +0 -461
  38. package/dist/components-IdP8GXXX.cjs.map +0 -1
  39. package/dist/fakerGenerator-CYUCNH3Q.cjs +0 -204
  40. package/dist/fakerGenerator-CYUCNH3Q.cjs.map +0 -1
  41. package/dist/fakerGenerator-M5oCrPmy.js +0 -200
  42. package/dist/fakerGenerator-M5oCrPmy.js.map +0 -1
  43. package/dist/types-r7BubMLO.d.ts +0 -132
  44. package/src/parser.ts +0 -453
package/dist/index.cjs CHANGED
@@ -1,11 +1,14 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_components = require("./components-IdP8GXXX.cjs");
3
- const require_fakerGenerator = require("./fakerGenerator-CYUCNH3Q.cjs");
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_Faker = require("./Faker-D39THFJ-.cjs");
6
+ const require_fakerGenerator = require("./fakerGenerator-B-XuVREg.cjs");
4
7
  let node_path = require("node:path");
5
- node_path = require_components.__toESM(node_path);
8
+ node_path = require_Faker.__toESM(node_path, 1);
6
9
  let _kubb_core = require("@kubb/core");
7
- let _kubb_plugin_oas = require("@kubb/plugin-oas");
8
10
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
11
+ let node_crypto = require("node:crypto");
9
12
  //#region ../../internals/utils/src/casing.ts
10
13
  /**
11
14
  * Shared implementation for camelCase and PascalCase conversion.
@@ -25,9 +28,12 @@ function toCamelOrPascal(text, pascal) {
25
28
  * Splits `text` on `.` and applies `transformPart` to each segment.
26
29
  * The last segment receives `isLast = true`, all earlier segments receive `false`.
27
30
  * Segments are joined with `/` to form a file path.
31
+ *
32
+ * Only splits on dots followed by a letter so that version numbers
33
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
28
34
  */
29
35
  function applyToFileParts(text, transformPart) {
30
- const parts = text.split(".");
36
+ const parts = text.split(/\.(?=[a-zA-Z])/);
31
37
  return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
32
38
  }
33
39
  /**
@@ -46,99 +52,246 @@ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
46
52
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
47
53
  }
48
54
  //#endregion
55
+ //#region ../../internals/utils/src/reserved.ts
56
+ /**
57
+ * JavaScript and Java reserved words.
58
+ * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
59
+ */
60
+ const reservedWords = new Set([
61
+ "abstract",
62
+ "arguments",
63
+ "boolean",
64
+ "break",
65
+ "byte",
66
+ "case",
67
+ "catch",
68
+ "char",
69
+ "class",
70
+ "const",
71
+ "continue",
72
+ "debugger",
73
+ "default",
74
+ "delete",
75
+ "do",
76
+ "double",
77
+ "else",
78
+ "enum",
79
+ "eval",
80
+ "export",
81
+ "extends",
82
+ "false",
83
+ "final",
84
+ "finally",
85
+ "float",
86
+ "for",
87
+ "function",
88
+ "goto",
89
+ "if",
90
+ "implements",
91
+ "import",
92
+ "in",
93
+ "instanceof",
94
+ "int",
95
+ "interface",
96
+ "let",
97
+ "long",
98
+ "native",
99
+ "new",
100
+ "null",
101
+ "package",
102
+ "private",
103
+ "protected",
104
+ "public",
105
+ "return",
106
+ "short",
107
+ "static",
108
+ "super",
109
+ "switch",
110
+ "synchronized",
111
+ "this",
112
+ "throw",
113
+ "throws",
114
+ "transient",
115
+ "true",
116
+ "try",
117
+ "typeof",
118
+ "var",
119
+ "void",
120
+ "volatile",
121
+ "while",
122
+ "with",
123
+ "yield",
124
+ "Array",
125
+ "Date",
126
+ "hasOwnProperty",
127
+ "Infinity",
128
+ "isFinite",
129
+ "isNaN",
130
+ "isPrototypeOf",
131
+ "length",
132
+ "Math",
133
+ "name",
134
+ "NaN",
135
+ "Number",
136
+ "Object",
137
+ "prototype",
138
+ "String",
139
+ "toString",
140
+ "undefined",
141
+ "valueOf"
142
+ ]);
143
+ /**
144
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * isValidVarName('status') // true
149
+ * isValidVarName('class') // false (reserved word)
150
+ * isValidVarName('42foo') // false (starts with digit)
151
+ * ```
152
+ */
153
+ function isValidVarName(name) {
154
+ if (!name || reservedWords.has(name)) return false;
155
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
156
+ }
157
+ //#endregion
158
+ //#region src/resolvers/resolverFaker.ts
159
+ /**
160
+ * Naming convention resolver for Faker plugin.
161
+ *
162
+ * Provides default naming helpers using camelCase with a `create` prefix for factory functions and files.
163
+ *
164
+ * @example
165
+ * `resolverFaker.default('list pets', 'function') // → 'createListPets'`
166
+ */
167
+ const resolverFaker = (0, _kubb_core.defineResolver)(() => {
168
+ return {
169
+ name: "default",
170
+ pluginName: "plugin-faker",
171
+ default(name, type) {
172
+ const resolvedName = camelCase(name, {
173
+ isFile: type === "file",
174
+ prefix: "create"
175
+ });
176
+ if (type === "file" || isValidVarName(resolvedName)) return resolvedName;
177
+ return `_${resolvedName}`;
178
+ },
179
+ resolveName(name, type) {
180
+ return this.default(name, type);
181
+ },
182
+ resolvePathName(name, type) {
183
+ return this.default(name, type);
184
+ },
185
+ resolveFile({ name, extname, tag, path: groupPath }, context) {
186
+ const pathMode = _kubb_core.PluginDriver.getMode(node_path.default.resolve(context.root, context.output.path));
187
+ const baseName = `${pathMode === "single" ? "" : this.resolveName(name, "file")}${extname}`;
188
+ const filePath = this.resolvePath({
189
+ baseName,
190
+ pathMode,
191
+ tag,
192
+ path: groupPath
193
+ }, context);
194
+ return {
195
+ kind: "File",
196
+ id: (0, node_crypto.createHash)("sha256").update(filePath).digest("hex"),
197
+ name: node_path.default.basename(filePath, extname),
198
+ path: filePath,
199
+ baseName,
200
+ extname,
201
+ meta: { pluginName: this.pluginName },
202
+ sources: [],
203
+ imports: [],
204
+ exports: []
205
+ };
206
+ },
207
+ resolveParamName(node, param) {
208
+ return this.resolveName(`${node.operationId} ${param.in} ${param.name}`);
209
+ },
210
+ resolveDataName(node) {
211
+ return this.resolveName(`${node.operationId} Data`);
212
+ },
213
+ resolveResponseStatusName(node, statusCode) {
214
+ return this.resolveName(`${node.operationId} Status ${statusCode}`);
215
+ },
216
+ resolveResponseName(node) {
217
+ return this.resolveName(`${node.operationId} Response`);
218
+ },
219
+ resolveResponsesName(node) {
220
+ return this.resolveName(`${node.operationId} Responses`);
221
+ },
222
+ resolvePathParamsName(node, param) {
223
+ return this.resolveParamName(node, param);
224
+ },
225
+ resolveQueryParamsName(node, param) {
226
+ return this.resolveParamName(node, param);
227
+ },
228
+ resolveHeaderParamsName(node, param) {
229
+ return this.resolveParamName(node, param);
230
+ }
231
+ };
232
+ });
233
+ //#endregion
49
234
  //#region src/plugin.ts
235
+ /**
236
+ * Canonical plugin name for `@kubb/plugin-faker`, used in driver lookups and warnings.
237
+ */
50
238
  const pluginFakerName = "plugin-faker";
51
- const pluginFaker = (0, _kubb_core.createPlugin)((options) => {
239
+ /**
240
+ * Generates Faker mock data factories from OpenAPI/AST specification.
241
+ *
242
+ * Creates randomized test data and mock helpers from schema definitions.
243
+ *
244
+ * @example
245
+ * `import pluginFaker from '@kubb/plugin-faker'; export default defineConfig({ plugins: [pluginFaker({ output: { path: 'mocks' } })], })`
246
+ */
247
+ const pluginFaker = (0, _kubb_core.definePlugin)((options) => {
52
248
  const { output = {
53
249
  path: "mocks",
54
250
  barrelType: "named"
55
- }, seed, group, exclude = [], include, override = [], transformers = {}, mapper = {}, unknownType = "any", emptySchemaType = unknownType, dateType = "string", integerType = "number", dateParser = "faker", generators = [require_fakerGenerator.fakerGenerator].filter(Boolean), regexGenerator = "faker", paramsCasing, contentType } = options;
251
+ }, seed, locale, group, exclude = [], include, override = [], mapper = {}, dateParser = "faker", generators: userGenerators = [], regexGenerator = "faker", paramsCasing, printer, resolver: userResolver, transformer: userTransformer } = options;
252
+ const groupConfig = group ? {
253
+ ...group,
254
+ name: group.name ? group.name : (ctx) => {
255
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
256
+ return `${camelCase(ctx.group)}Controller`;
257
+ }
258
+ } : void 0;
56
259
  return {
57
260
  name: pluginFakerName,
58
- options: {
59
- output,
60
- transformers,
61
- seed,
62
- dateType,
63
- integerType,
64
- unknownType,
65
- emptySchemaType,
66
- dateParser,
67
- mapper,
68
- override,
69
- regexGenerator,
70
- paramsCasing,
71
- group,
72
- usedEnumNames: {}
73
- },
74
- pre: [_kubb_plugin_oas.pluginOasName, _kubb_plugin_ts.pluginTsName],
75
- resolvePath(baseName, pathMode, options) {
76
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
77
- if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
78
- /**
79
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
80
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
81
- */
82
- return node_path.default.resolve(root, output.path);
83
- if (group && (options?.group?.path || options?.group?.tag)) {
84
- const groupName = group?.name ? group.name : (ctx) => {
85
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
86
- return `${camelCase(ctx.group)}Controller`;
87
- };
88
- return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
89
- }
90
- return node_path.default.resolve(root, output.path, baseName);
91
- },
92
- resolveName(name, type) {
93
- const resolvedName = camelCase(name, {
94
- prefix: type ? "create" : void 0,
95
- isFile: type === "file"
96
- });
97
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
98
- return resolvedName;
99
- },
100
- async install() {
101
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
102
- const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
103
- const oas = await this.getOas();
104
- const schemaFiles = await new _kubb_plugin_oas.SchemaGenerator(this.plugin.options, {
105
- fabric: this.fabric,
106
- oas,
107
- driver: this.driver,
108
- events: this.events,
109
- plugin: this.plugin,
110
- contentType,
111
- include: void 0,
112
- override,
113
- mode,
114
- output: output.path
115
- }).build(...generators);
116
- await this.upsertFile(...schemaFiles);
117
- const operationFiles = await new _kubb_plugin_oas.OperationGenerator(this.plugin.options, {
118
- fabric: this.fabric,
119
- oas,
120
- driver: this.driver,
121
- events: this.events,
122
- plugin: this.plugin,
123
- contentType,
261
+ options,
262
+ dependencies: [_kubb_plugin_ts.pluginTsName],
263
+ hooks: { "kubb:plugin:setup"(ctx) {
264
+ ctx.setOptions({
265
+ output,
266
+ seed,
267
+ locale,
124
268
  exclude,
125
269
  include,
126
270
  override,
127
- mode
128
- }).build(...generators);
129
- await this.upsertFile(...operationFiles);
130
- const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
131
- type: output.barrelType ?? "named",
132
- root,
133
- output,
134
- meta: { pluginName: this.plugin.name }
271
+ group: groupConfig,
272
+ mapper,
273
+ dateParser,
274
+ regexGenerator,
275
+ paramsCasing,
276
+ printer
135
277
  });
136
- await this.upsertFile(...barrelFiles);
137
- }
278
+ ctx.setResolver(userResolver ? {
279
+ ...resolverFaker,
280
+ ...userResolver
281
+ } : resolverFaker);
282
+ if (userTransformer) ctx.setTransformer(userTransformer);
283
+ ctx.addGenerator(require_fakerGenerator.fakerGenerator);
284
+ for (const generator of userGenerators) ctx.addGenerator(generator);
285
+ } }
138
286
  };
139
287
  });
140
288
  //#endregion
289
+ exports.Faker = require_Faker.Faker;
290
+ exports.default = pluginFaker;
291
+ exports.fakerGenerator = require_fakerGenerator.fakerGenerator;
141
292
  exports.pluginFaker = pluginFaker;
142
293
  exports.pluginFakerName = pluginFakerName;
294
+ exports.printerFaker = require_fakerGenerator.printerFaker;
295
+ exports.resolverFaker = resolverFaker;
143
296
 
144
297
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["fakerGenerator","pluginOasName","pluginTsName","path","SchemaGenerator","OperationGenerator"],"sources":["../../../internals/utils/src/casing.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /** When `true`, dot-separated segments are split on `.` and joined with `/` after casing. */\n isFile?: boolean\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split('.')\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { createPlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = createPlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n integerType = 'number',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n paramsCasing,\n contentType,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n options: {\n output,\n transformers,\n seed,\n dateType,\n integerType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n regexGenerator,\n paramsCasing,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\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)}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 const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\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 schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC3E,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;AAQjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AAClG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAW,UAAU,MAAM,SAAS;EAAE;EAAQ;EAAQ,GAAG,EAAE,CAAC,CAAC;AAGpG,QAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,MAAM;;;;ACnD9D,MAAa,kBAAkB;AAE/B,MAAa,eAAA,GAAA,WAAA,eAAyC,YAAY;CAChE,MAAM,EACJ,SAA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AEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,UAAAA,QAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,QAAA,GAAA,WAAA,SAAeA,UAAAA,QAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,cAAc,MAbI,IAAIC,iBAAAA,gBAAgB,KAAK,OAAO,SAAS;IAC/D,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA,SAAS,KAAA;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAerC,MAAM,iBAAiB,MAbI,IAAIC,iBAAAA,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,OAAA,GAAA,WAAA,gBAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["PluginDriver","path","pluginTsName","fakerGenerator"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../src/resolvers/resolverFaker.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { createHash } from 'node:crypto'\nimport path from 'node:path'\nimport { camelCase, isValidVarName } from '@internals/utils'\nimport { defineResolver, PluginDriver } from '@kubb/core'\nimport type { PluginFaker } from '../types.ts'\n\n/**\n * Naming convention resolver for Faker plugin.\n *\n * Provides default naming helpers using camelCase with a `create` prefix for factory functions and files.\n *\n * @example\n * `resolverFaker.default('list pets', 'function') // → 'createListPets'`\n */\nexport const resolverFaker = defineResolver<PluginFaker>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-faker',\n default(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file', prefix: 'create' })\n\n if (type === 'file' || isValidVarName(resolvedName)) {\n return resolvedName\n }\n\n return `_${resolvedName}`\n },\n resolveName(name, type) {\n return this.default(name, type)\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveFile({ name, extname, tag, path: groupPath }, context) {\n const pathMode = PluginDriver.getMode(path.resolve(context.root, context.output.path))\n const baseName = `${pathMode === 'single' ? '' : this.resolveName(name, 'file')}${extname}` as `${string}.${string}`\n const filePath = this.resolvePath(\n {\n baseName,\n pathMode,\n tag,\n path: groupPath,\n },\n context,\n )\n\n return {\n kind: 'File',\n id: createHash('sha256').update(filePath).digest('hex'),\n name: path.basename(filePath, extname),\n path: filePath,\n baseName,\n extname,\n meta: { pluginName: this.pluginName },\n sources: [],\n imports: [],\n exports: [],\n }\n },\n resolveParamName(node, param) {\n return this.resolveName(`${node.operationId} ${param.in} ${param.name}`)\n },\n resolveDataName(node) {\n return this.resolveName(`${node.operationId} Data`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveName(`${node.operationId} Status ${statusCode}`)\n },\n resolveResponseName(node) {\n return this.resolveName(`${node.operationId} Response`)\n },\n resolveResponsesName(node) {\n return this.resolveName(`${node.operationId} Responses`)\n },\n resolvePathParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveQueryParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveHeaderParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n }\n})\n","import { camelCase } from '@internals/utils'\nimport { definePlugin, type Group } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport { resolverFaker } from './resolvers/resolverFaker.ts'\nimport type { PluginFaker } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-faker`, used in driver lookups and warnings.\n */\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\n/**\n * Generates Faker mock data factories from OpenAPI/AST specification.\n *\n * Creates randomized test data and mock helpers from schema definitions.\n *\n * @example\n * `import pluginFaker from '@kubb/plugin-faker'; export default defineConfig({ plugins: [pluginFaker({ output: { path: 'mocks' } })], })`\n */\nexport const pluginFaker = definePlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n locale,\n group,\n exclude = [],\n include,\n override = [],\n mapper = {},\n dateParser = 'faker',\n generators: userGenerators = [],\n regexGenerator = 'faker',\n paramsCasing,\n printer,\n resolver: userResolver,\n transformer: userTransformer,\n } = options\n\n const groupConfig = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginFakerName,\n options,\n dependencies: [pluginTsName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n seed,\n locale,\n exclude,\n include,\n override,\n group: groupConfig,\n mapper,\n dateParser,\n regexGenerator,\n paramsCasing,\n printer,\n })\n ctx.setResolver(userResolver ? { ...resolverFaker, ...userResolver } : resolverFaker)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(fakerGenerator)\n for (const generator of userGenerators) {\n ctx.addGenerator(generator)\n }\n },\n },\n }\n})\n\nexport default pluginFaker\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAEH,CAAC,MAAM,gBAAgB,CAAC,OAAO,QAE3C,CACT,KAAK,MAAM,MAAM;EAEhB,IADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,EACjD,OAAO;EACrB,IAAI,MAAM,KAAK,CAAC,QAAQ,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;EAC3E,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;CAC1C,OAAO,MAAM,KAAK,MAA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;;;AC1EF,MAAa,kBAAkB;;;;;;;;;AAU/B,MAAa,eAAA,GAAA,WAAA,eAAyC,YAAY;CAChE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,MACA,QACA,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,EAAE,EACX,aAAa,SACb,YAAY,iBAAiB,EAAE,EAC/B,iBAAiB,SACjB,cACA,SACA,UAAU,cACV,aAAa,oBACX;CAEJ,MAAM,cAAc,QACf;EACC,GAAG;EACH,MAAM,MAAM,OACR,MAAM,QACL,QAA2B;GAC1B,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;GAGjC,OAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;EAEtC,GACD,KAAA;CAEJ,OAAO;EACL,MAAM;EACN;EACA,cAAc,CAACC,gBAAAA,aAAa;EAC5B,OAAO,EACL,oBAAoB,KAAK;GACvB,IAAI,WAAW;IACb;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACD,CAAC;GACF,IAAI,YAAY,eAAe;IAAE,GAAG;IAAe,GAAG;IAAc,GAAG,cAAc;GACrF,IAAI,iBACF,IAAI,eAAe,gBAAgB;GAErC,IAAI,aAAaC,uBAAAA,eAAe;GAChC,KAAK,MAAM,aAAa,gBACtB,IAAI,aAAa,UAAU;KAGhC;EACF;EACD"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,34 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { n as PluginFaker, t as Options } from "./types-r7BubMLO.js";
3
- import * as _kubb_core0 from "@kubb/core";
2
+ import { a as Options, i as printerFaker, n as PrinterFakerNodes, o as PluginFaker, r as PrinterFakerOptions, s as ResolverFaker, t as PrinterFakerFactory } from "./printerFaker-W0pLunAj.js";
3
+ import { t as Faker } from "./Faker-BMgoFj8b.js";
4
+ import { t as fakerGenerator } from "./fakerGenerator-B-QnVz9o.js";
5
+ import * as _$_kubb_core0 from "@kubb/core";
4
6
 
5
7
  //#region src/plugin.d.ts
8
+ /**
9
+ * Canonical plugin name for `@kubb/plugin-faker`, used in driver lookups and warnings.
10
+ */
6
11
  declare const pluginFakerName = "plugin-faker";
7
- declare const pluginFaker: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginFaker>;
12
+ /**
13
+ * Generates Faker mock data factories from OpenAPI/AST specification.
14
+ *
15
+ * Creates randomized test data and mock helpers from schema definitions.
16
+ *
17
+ * @example
18
+ * `import pluginFaker from '@kubb/plugin-faker'; export default defineConfig({ plugins: [pluginFaker({ output: { path: 'mocks' } })], })`
19
+ */
20
+ declare const pluginFaker: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginFaker>;
8
21
  //#endregion
9
- export { type PluginFaker, pluginFaker, pluginFakerName };
22
+ //#region src/resolvers/resolverFaker.d.ts
23
+ /**
24
+ * Naming convention resolver for Faker plugin.
25
+ *
26
+ * Provides default naming helpers using camelCase with a `create` prefix for factory functions and files.
27
+ *
28
+ * @example
29
+ * `resolverFaker.default('list pets', 'function') // → 'createListPets'`
30
+ */
31
+ declare const resolverFaker: ResolverFaker;
32
+ //#endregion
33
+ export { Faker, type PluginFaker, type PrinterFakerFactory, type PrinterFakerNodes, type PrinterFakerOptions, type ResolverFaker, pluginFaker as default, pluginFaker, fakerGenerator, pluginFakerName, printerFaker, resolverFaker };
10
34
  //# sourceMappingURL=index.d.ts.map