@kubb/plugin-faker 5.0.0-alpha.8 → 5.0.0-beta.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.
- package/LICENSE +17 -10
- package/README.md +1 -4
- package/dist/Faker-BgleOzVN.cjs +486 -0
- package/dist/Faker-BgleOzVN.cjs.map +1 -0
- package/dist/Faker-CdyPfOPg.d.ts +27 -0
- package/dist/Faker-fcQEB9i5.js +384 -0
- package/dist/Faker-fcQEB9i5.js.map +1 -0
- package/dist/components.cjs +2 -2
- package/dist/components.d.ts +2 -31
- package/dist/components.js +1 -1
- package/dist/fakerGenerator-C3Ho3BaI.d.ts +9 -0
- package/dist/fakerGenerator-D7daHCh6.js +516 -0
- package/dist/fakerGenerator-D7daHCh6.js.map +1 -0
- package/dist/fakerGenerator-VJEVzLjc.cjs +526 -0
- package/dist/fakerGenerator-VJEVzLjc.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -476
- package/dist/generators.js +1 -1
- package/dist/index.cjs +136 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +128 -83
- package/dist/index.js.map +1 -1
- package/dist/printerFaker-CJiwzoto.d.ts +206 -0
- package/package.json +52 -50
- package/src/components/Faker.tsx +124 -78
- package/src/generators/fakerGenerator.tsx +235 -134
- package/src/index.ts +7 -2
- package/src/plugin.ts +60 -121
- package/src/printers/printerFaker.ts +341 -0
- package/src/resolvers/resolverFaker.ts +92 -0
- package/src/types.ts +127 -81
- package/src/utils.ts +356 -0
- package/dist/components-BkBIov4R.js +0 -419
- package/dist/components-BkBIov4R.js.map +0 -1
- package/dist/components-IdP8GXXX.cjs +0 -461
- package/dist/components-IdP8GXXX.cjs.map +0 -1
- package/dist/fakerGenerator-CYUCNH3Q.cjs +0 -204
- package/dist/fakerGenerator-CYUCNH3Q.cjs.map +0 -1
- package/dist/fakerGenerator-M5oCrPmy.js +0 -200
- package/dist/fakerGenerator-M5oCrPmy.js.map +0 -1
- package/dist/types-r7BubMLO.d.ts +0 -132
- package/src/parser.ts +0 -453
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import { ast } from "@kubb/core";
|
|
4
|
+
import { functionPrinter } from "@kubb/plugin-ts";
|
|
5
|
+
import { File, Function } from "@kubb/renderer-jsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
7
|
+
//#region ../../internals/utils/src/string.ts
|
|
8
|
+
/**
|
|
9
|
+
* Strips a single matching pair of `"..."`, `'...'`, or `` `...` `` from both ends of `text`.
|
|
10
|
+
* Returns the string unchanged when no balanced quote pair is found.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* trimQuotes('"hello"') // 'hello'
|
|
14
|
+
* trimQuotes('hello') // 'hello'
|
|
15
|
+
*/
|
|
16
|
+
function trimQuotes(text) {
|
|
17
|
+
if (text.length >= 2) {
|
|
18
|
+
const first = text[0];
|
|
19
|
+
const last = text[text.length - 1];
|
|
20
|
+
if (first === "\"" && last === "\"" || first === "'" && last === "'" || first === "`" && last === "`") return text.slice(1, -1);
|
|
21
|
+
}
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Escapes characters that are not allowed inside JS string literals.
|
|
26
|
+
* Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).
|
|
27
|
+
*
|
|
28
|
+
* @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* jsStringEscape('say "hi"\nbye') // 'say \\"hi\\"\\nbye'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
function jsStringEscape(input) {
|
|
36
|
+
return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
37
|
+
switch (character) {
|
|
38
|
+
case "\"":
|
|
39
|
+
case "'":
|
|
40
|
+
case "\\": return `\\${character}`;
|
|
41
|
+
case "\n": return "\\n";
|
|
42
|
+
case "\r": return "\\r";
|
|
43
|
+
case "\u2028": return "\\u2028";
|
|
44
|
+
case "\u2029": return "\\u2029";
|
|
45
|
+
default: return "";
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/utils.ts
|
|
51
|
+
/**
|
|
52
|
+
* Returns the `@faker-js/faker` named export for a locale code.
|
|
53
|
+
*
|
|
54
|
+
* Without a locale, returns `'faker'` for the default English instance.
|
|
55
|
+
* With a locale, the language code is converted to upper case and joined with any region suffix.
|
|
56
|
+
*
|
|
57
|
+
* @example Default
|
|
58
|
+
* `localeToFakerImport() // 'faker'`
|
|
59
|
+
*
|
|
60
|
+
* @example Simple locale
|
|
61
|
+
* `localeToFakerImport('de') // 'fakerDE'`
|
|
62
|
+
*
|
|
63
|
+
* @example Compound locale
|
|
64
|
+
* `localeToFakerImport('de_AT') // 'fakerDE_AT'`
|
|
65
|
+
*/
|
|
66
|
+
function localeToFakerImport(locale) {
|
|
67
|
+
if (!locale) return "faker";
|
|
68
|
+
const parts = locale.split("_");
|
|
69
|
+
parts[0] = parts[0].toUpperCase();
|
|
70
|
+
return `faker${parts.join("_")}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Determines if a schema node can be overridden during faker generation.
|
|
74
|
+
*/
|
|
75
|
+
function canOverrideSchema(node) {
|
|
76
|
+
return new Set([
|
|
77
|
+
"array",
|
|
78
|
+
"tuple",
|
|
79
|
+
"object",
|
|
80
|
+
"intersection",
|
|
81
|
+
"union",
|
|
82
|
+
"enum",
|
|
83
|
+
"ref",
|
|
84
|
+
"string",
|
|
85
|
+
"email",
|
|
86
|
+
"url",
|
|
87
|
+
"uuid",
|
|
88
|
+
"number",
|
|
89
|
+
"integer",
|
|
90
|
+
"bigint",
|
|
91
|
+
"boolean",
|
|
92
|
+
"date",
|
|
93
|
+
"time",
|
|
94
|
+
"datetime",
|
|
95
|
+
"blob"
|
|
96
|
+
]).has(node.type);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a schema reference by looking up the referenced schema in the provided array.
|
|
100
|
+
* Returns the original node if it's not a reference.
|
|
101
|
+
*/
|
|
102
|
+
function resolveSchemaRef(node, schemas) {
|
|
103
|
+
if (node.type !== "ref") return node;
|
|
104
|
+
return schemas.find((schema) => schema.name === node.name && schema.type !== "ref") ?? node;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolves a parameter name based on its location (path, query, header, etc.) using the provided resolver.
|
|
108
|
+
*/
|
|
109
|
+
function resolveParamNameByLocation(resolver, node, param) {
|
|
110
|
+
switch (param.in) {
|
|
111
|
+
case "path": return resolver.resolvePathParamsName(node, param);
|
|
112
|
+
case "query": return resolver.resolveQueryParamsName(node, param);
|
|
113
|
+
case "header": return resolver.resolveHeaderParamsName(node, param);
|
|
114
|
+
default: return resolver.resolveParamName(node, param);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function shouldInlineSingleResponseSchema(schema) {
|
|
118
|
+
return new Set([
|
|
119
|
+
"any",
|
|
120
|
+
"unknown",
|
|
121
|
+
"void",
|
|
122
|
+
"null",
|
|
123
|
+
"array",
|
|
124
|
+
"tuple",
|
|
125
|
+
"string",
|
|
126
|
+
"email",
|
|
127
|
+
"url",
|
|
128
|
+
"uuid",
|
|
129
|
+
"number",
|
|
130
|
+
"integer",
|
|
131
|
+
"bigint",
|
|
132
|
+
"boolean",
|
|
133
|
+
"date",
|
|
134
|
+
"time",
|
|
135
|
+
"datetime",
|
|
136
|
+
"blob",
|
|
137
|
+
"enum",
|
|
138
|
+
"union"
|
|
139
|
+
]).has(schema.type);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Builds a response schema as a union of all response statuses.
|
|
143
|
+
* Returns null if no responses are provided, or embeds single simple responses inline.
|
|
144
|
+
*/
|
|
145
|
+
function buildResponseUnionSchema(node, resolver) {
|
|
146
|
+
const responses = node.responses.filter((response) => response.schema);
|
|
147
|
+
if (!responses.length) return null;
|
|
148
|
+
if (responses.length === 1) {
|
|
149
|
+
if (shouldInlineSingleResponseSchema(responses[0].schema)) return responses[0].schema;
|
|
150
|
+
return ast.createSchema({
|
|
151
|
+
type: "ref",
|
|
152
|
+
name: resolver.resolveResponseStatusName(node, responses[0].statusCode)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return ast.createSchema({
|
|
156
|
+
type: "union",
|
|
157
|
+
members: responses.map((response) => ast.createSchema({
|
|
158
|
+
type: "ref",
|
|
159
|
+
name: resolver.resolveResponseStatusName(node, response.statusCode)
|
|
160
|
+
}))
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const SCALAR_TYPES$1 = new Set([
|
|
164
|
+
"string",
|
|
165
|
+
"email",
|
|
166
|
+
"url",
|
|
167
|
+
"uuid",
|
|
168
|
+
"number",
|
|
169
|
+
"integer",
|
|
170
|
+
"bigint",
|
|
171
|
+
"boolean",
|
|
172
|
+
"date",
|
|
173
|
+
"time",
|
|
174
|
+
"datetime",
|
|
175
|
+
"blob",
|
|
176
|
+
"enum"
|
|
177
|
+
]);
|
|
178
|
+
const ARRAY_TYPES$1 = new Set(["array"]);
|
|
179
|
+
function toRelativeImportPath(from, to) {
|
|
180
|
+
const relativePath = posix.relative(posix.dirname(from), to);
|
|
181
|
+
return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
|
|
182
|
+
}
|
|
183
|
+
function escapeRegExp(value) {
|
|
184
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Filters imports to only those that are actually used in the generated code.
|
|
188
|
+
* Checks for function calls matching the imported names.
|
|
189
|
+
*/
|
|
190
|
+
function filterUsedImports(imports, text, skipImportNames = []) {
|
|
191
|
+
return imports.filter((entry) => {
|
|
192
|
+
return (Array.isArray(entry.name) ? entry.name : [entry.name]).map((name) => {
|
|
193
|
+
if (typeof name === "string") return name;
|
|
194
|
+
return name?.name ?? name?.propertyName;
|
|
195
|
+
}).filter((name) => Boolean(name)).some((name) => {
|
|
196
|
+
if (skipImportNames.includes(name)) return false;
|
|
197
|
+
return new RegExp(`\\b${escapeRegExp(name)}\\b(?=\\s*\\()`).test(text);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Detects and resolves import name conflicts by adding aliases to conflicting names.
|
|
203
|
+
* Returns updated imports with a mapping of original names to their aliases.
|
|
204
|
+
*/
|
|
205
|
+
function aliasConflictingImports(imports, reservedNames) {
|
|
206
|
+
const reservedNameSet = new Set(reservedNames);
|
|
207
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
208
|
+
return {
|
|
209
|
+
imports: imports.map((entry) => {
|
|
210
|
+
const aliasedNames = (Array.isArray(entry.name) ? entry.name : [entry.name]).map((item) => {
|
|
211
|
+
if (typeof item !== "string" || !reservedNameSet.has(item)) return item;
|
|
212
|
+
const alias = `${item}Schema`;
|
|
213
|
+
aliases.set(item, alias);
|
|
214
|
+
return {
|
|
215
|
+
propertyName: item,
|
|
216
|
+
name: alias
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
return aliasedNames.some((item) => typeof item === "object" && item.name) ? {
|
|
220
|
+
...entry,
|
|
221
|
+
name: aliasedNames
|
|
222
|
+
} : entry;
|
|
223
|
+
}),
|
|
224
|
+
aliases
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Replaces all occurrences of original names with their aliased versions in the given text.
|
|
229
|
+
*/
|
|
230
|
+
function rewriteAliasedImports(text, aliases) {
|
|
231
|
+
return Array.from(aliases).reduce((acc, [name, alias]) => acc.replace(new RegExp(`\\b${escapeRegExp(name)}\\b`, "g"), alias), text);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Resolves a type reference, determining if it needs an import statement or inline type reference.
|
|
235
|
+
* Takes into account whether the type can be overridden and the file paths.
|
|
236
|
+
*/
|
|
237
|
+
function resolveTypeReference({ node, canOverride, name, typeName, filePath, typeFilePath }) {
|
|
238
|
+
const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
239
|
+
if (!usesTypeName) return { typeName };
|
|
240
|
+
if (name === typeName) return { typeName: `import('${toRelativeImportPath(filePath, typeFilePath)}').${typeName}` };
|
|
241
|
+
return {
|
|
242
|
+
importPath: typeFilePath,
|
|
243
|
+
typeName
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Maps a schema node type to its corresponding scalar type representation.
|
|
248
|
+
* Returns the type name for enums or the base type (string, number, etc.) for primitives.
|
|
249
|
+
*/
|
|
250
|
+
function getScalarType(node, typeName) {
|
|
251
|
+
switch (node.type) {
|
|
252
|
+
case "string":
|
|
253
|
+
case "email":
|
|
254
|
+
case "url":
|
|
255
|
+
case "uuid": return "string";
|
|
256
|
+
case "number":
|
|
257
|
+
case "integer": return "number";
|
|
258
|
+
case "bigint": return "bigint";
|
|
259
|
+
case "boolean": return "boolean";
|
|
260
|
+
case "date":
|
|
261
|
+
case "time": return node.representation === "date" ? "Date" : "string";
|
|
262
|
+
case "datetime": return "string";
|
|
263
|
+
case "blob": return "Blob";
|
|
264
|
+
case "enum": return typeName;
|
|
265
|
+
default: return typeName;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Resolves faker type usage information for a schema.
|
|
270
|
+
* Determines the data type, return type, and whether it uses the type name.
|
|
271
|
+
*/
|
|
272
|
+
function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
273
|
+
const isArray = ARRAY_TYPES$1.has(node.type);
|
|
274
|
+
const isTuple = node.type === "tuple";
|
|
275
|
+
const isScalar = SCALAR_TYPES$1.has(node.type);
|
|
276
|
+
let dataType = `Partial<${typeName}>`;
|
|
277
|
+
if (isArray || isTuple || node.type === "union" || node.type === "enum") dataType = typeName;
|
|
278
|
+
if (isScalar) dataType = getScalarType(node, typeName);
|
|
279
|
+
let returnType = canOverride ? typeName : void 0;
|
|
280
|
+
if (isScalar) returnType = getScalarType(node, typeName);
|
|
281
|
+
return {
|
|
282
|
+
dataType,
|
|
283
|
+
returnType,
|
|
284
|
+
usesTypeName: dataType.includes(typeName) || Boolean(returnType?.includes(typeName))
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/components/Faker.tsx
|
|
289
|
+
const OBJECT_TYPES = new Set(["object", "intersection"]);
|
|
290
|
+
const ARRAY_TYPES = new Set(["array"]);
|
|
291
|
+
const SCALAR_TYPES = new Set([
|
|
292
|
+
"string",
|
|
293
|
+
"email",
|
|
294
|
+
"url",
|
|
295
|
+
"uuid",
|
|
296
|
+
"number",
|
|
297
|
+
"integer",
|
|
298
|
+
"bigint",
|
|
299
|
+
"boolean",
|
|
300
|
+
"date",
|
|
301
|
+
"time",
|
|
302
|
+
"datetime",
|
|
303
|
+
"blob",
|
|
304
|
+
"enum"
|
|
305
|
+
]);
|
|
306
|
+
const declarationPrinter = functionPrinter({ mode: "declaration" });
|
|
307
|
+
function Faker({ node, description, name, typeName, printer, seed, canOverride }) {
|
|
308
|
+
const fakerText = printer.print(node) ?? "undefined";
|
|
309
|
+
const isArray = ARRAY_TYPES.has(node.type);
|
|
310
|
+
const isObject = OBJECT_TYPES.has(node.type);
|
|
311
|
+
const isTuple = node.type === "tuple";
|
|
312
|
+
const isScalar = SCALAR_TYPES.has(node.type);
|
|
313
|
+
let fakerTextWithOverride = fakerText;
|
|
314
|
+
let useGenericOverride = false;
|
|
315
|
+
if (canOverride && isObject) useGenericOverride = true;
|
|
316
|
+
if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`;
|
|
317
|
+
if (canOverride && isArray) fakerTextWithOverride = `[
|
|
318
|
+
...${fakerText},
|
|
319
|
+
...(data || [])
|
|
320
|
+
]`;
|
|
321
|
+
if (canOverride && isScalar) fakerTextWithOverride = `data ?? ${fakerText}`;
|
|
322
|
+
const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
323
|
+
let functionSignature = "";
|
|
324
|
+
let functionBody = "";
|
|
325
|
+
if (useGenericOverride) {
|
|
326
|
+
functionSignature = `${description ? `/**\n * @description ${jsStringEscape(description)}\n */\n ` : ""}export function ${name}(data?: Partial<${typeName}>): Required<${typeName}>`;
|
|
327
|
+
const seedCode = seed ? `faker.seed(${JSON.stringify(seed)})\n ` : "";
|
|
328
|
+
const { cyclicSchemas, schemaName } = printer.options;
|
|
329
|
+
if (node.type === "object" && !!cyclicSchemas && (node.properties ?? []).some((p) => ast.containsCircularRef(p.schema, {
|
|
330
|
+
circularSchemas: cyclicSchemas,
|
|
331
|
+
excludeName: schemaName
|
|
332
|
+
}))) functionBody = `{
|
|
333
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
334
|
+
if (data) {
|
|
335
|
+
for (const [key, value] of Object.entries(data)) {
|
|
336
|
+
Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return defaultFakeData as Required<${typeName}>
|
|
340
|
+
}`;
|
|
341
|
+
else functionBody = `{
|
|
342
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
343
|
+
return {
|
|
344
|
+
...defaultFakeData,
|
|
345
|
+
...(data || {}),
|
|
346
|
+
} as Required<${typeName}>
|
|
347
|
+
}`;
|
|
348
|
+
} else {
|
|
349
|
+
const dataParamName = /\bdata\b/.test(fakerTextWithOverride) ? "data" : "_data";
|
|
350
|
+
const params = ast.createFunctionParameters({ params: [ast.createFunctionParameter({
|
|
351
|
+
name: dataParamName,
|
|
352
|
+
type: ast.createParamsType({
|
|
353
|
+
variant: "reference",
|
|
354
|
+
name: dataType
|
|
355
|
+
}),
|
|
356
|
+
optional: true
|
|
357
|
+
})] });
|
|
358
|
+
const paramsSignature = declarationPrinter.print(params) ?? "";
|
|
359
|
+
const returnType = resolvedReturnType;
|
|
360
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
361
|
+
name,
|
|
362
|
+
isExportable: true,
|
|
363
|
+
isIndexable: true,
|
|
364
|
+
children: /* @__PURE__ */ jsxs(Function, {
|
|
365
|
+
export: true,
|
|
366
|
+
name,
|
|
367
|
+
JSDoc: { comments: description ? [`@description ${jsStringEscape(description)}`] : [] },
|
|
368
|
+
params: canOverride ? paramsSignature : void 0,
|
|
369
|
+
returnType,
|
|
370
|
+
children: [seed ? /* @__PURE__ */ jsxs(Fragment, { children: [`faker.seed(${JSON.stringify(seed)})`, /* @__PURE__ */ jsx("br", {})] }) : void 0, `return ${fakerTextWithOverride}`]
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return /* @__PURE__ */ jsxs(File.Source, {
|
|
375
|
+
name,
|
|
376
|
+
isExportable: true,
|
|
377
|
+
isIndexable: true,
|
|
378
|
+
children: [functionSignature, functionBody]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
export { filterUsedImports as a, resolveSchemaRef as c, trimQuotes as d, canOverrideSchema as i, resolveTypeReference as l, aliasConflictingImports as n, localeToFakerImport as o, buildResponseUnionSchema as r, resolveParamNameByLocation as s, Faker as t, rewriteAliasedImports as u };
|
|
383
|
+
|
|
384
|
+
//# sourceMappingURL=Faker-fcQEB9i5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Faker-fcQEB9i5.js","names":["SCALAR_TYPES","ARRAY_TYPES"],"sources":["../../../internals/utils/src/string.ts","../src/utils.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { posix } from 'node:path'\nimport { ast } from '@kubb/core'\nimport type { ResolverFaker } from './types.ts'\n\n/**\n * Returns the `@faker-js/faker` named export for a locale code.\n *\n * Without a locale, returns `'faker'` for the default English instance.\n * With a locale, the language code is converted to upper case and joined with any region suffix.\n *\n * @example Default\n * `localeToFakerImport() // 'faker'`\n *\n * @example Simple locale\n * `localeToFakerImport('de') // 'fakerDE'`\n *\n * @example Compound locale\n * `localeToFakerImport('de_AT') // 'fakerDE_AT'`\n */\nexport function localeToFakerImport(locale?: string): string {\n if (!locale) {\n return 'faker'\n }\n\n const parts = locale.split('_')\n parts[0] = parts[0]!.toUpperCase()\n return `faker${parts.join('_')}`\n}\n\n/**\n * Determines if a schema node can be overridden during faker generation.\n */\nexport function canOverrideSchema(node: ast.SchemaNode): boolean {\n return new Set<ast.SchemaNode['type']>([\n 'array',\n 'tuple',\n 'object',\n 'intersection',\n 'union',\n 'enum',\n 'ref',\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n ]).has(node.type)\n}\n\n/**\n * Resolves a schema reference by looking up the referenced schema in the provided array.\n * Returns the original node if it's not a reference.\n */\nexport function resolveSchemaRef(node: ast.SchemaNode, schemas: Array<ast.SchemaNode>): ast.SchemaNode {\n if (node.type !== 'ref') {\n return node\n }\n\n return schemas.find((schema) => schema.name === node.name && schema.type !== 'ref') ?? node\n}\n\n/**\n * Resolves a parameter name based on its location (path, query, header, etc.) using the provided resolver.\n */\nexport function resolveParamNameByLocation(\n resolver: Pick<ResolverFaker, 'resolvePathParamsName' | 'resolveQueryParamsName' | 'resolveHeaderParamsName' | 'resolveParamName'>,\n node: ast.OperationNode,\n param: ast.ParameterNode,\n): string {\n switch (param.in) {\n case 'path':\n return resolver.resolvePathParamsName(node, param)\n case 'query':\n return resolver.resolveQueryParamsName(node, param)\n case 'header':\n return resolver.resolveHeaderParamsName(node, param)\n default:\n return resolver.resolveParamName(node, param)\n }\n}\n\nfunction shouldInlineSingleResponseSchema(schema: ast.SchemaNode): boolean {\n return new Set<ast.SchemaNode['type']>([\n 'any',\n 'unknown',\n 'void',\n 'null',\n 'array',\n 'tuple',\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n 'union',\n ]).has(schema.type)\n}\n\n/**\n * Builds a response schema as a union of all response statuses.\n * Returns null if no responses are provided, or embeds single simple responses inline.\n */\nexport function buildResponseUnionSchema(node: ast.OperationNode, resolver: ResolverFaker): ast.SchemaNode | null {\n const responses = node.responses.filter((response) => response.schema)\n\n if (!responses.length) {\n return null\n }\n\n if (responses.length === 1) {\n if (shouldInlineSingleResponseSchema(responses[0]!.schema)) {\n return responses[0]!.schema\n }\n\n return ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, responses[0]!.statusCode) })\n }\n\n return ast.createSchema({\n type: 'union',\n members: responses.map((response) => ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, response.statusCode) })),\n })\n}\n\n/**\n * Import name that can be a string or a renamed import object.\n */\nexport type ImportName = string | { propertyName: string; name?: string }\n\n/**\n * Import entry containing module path and imported names.\n */\nexport type ImportEntry = {\n name: string | Array<ImportName>\n path: string\n}\n\nconst SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst ARRAY_TYPES = new Set<ast.SchemaNode['type']>(['array'])\n\nfunction toRelativeImportPath(from: string, to: string): string {\n const relativePath = posix.relative(posix.dirname(from), to)\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Filters imports to only those that are actually used in the generated code.\n * Checks for function calls matching the imported names.\n */\nexport function filterUsedImports(imports: Array<ImportEntry>, text: string, skipImportNames: Array<string> = []): Array<ImportEntry> {\n return imports.filter((entry) => {\n const names = (Array.isArray(entry.name) ? entry.name : [entry.name])\n .map((name) => {\n if (typeof name === 'string') {\n return name\n }\n\n return name?.name ?? name?.propertyName\n })\n .filter((name): name is string => Boolean(name))\n\n return names.some((name) => {\n if (skipImportNames.includes(name)) {\n return false\n }\n\n return new RegExp(`\\\\b${escapeRegExp(name)}\\\\b(?=\\\\s*\\\\()`).test(text)\n })\n })\n}\n\n/**\n * Detects and resolves import name conflicts by adding aliases to conflicting names.\n * Returns updated imports with a mapping of original names to their aliases.\n */\nexport function aliasConflictingImports(\n imports: Array<ImportEntry>,\n reservedNames: Iterable<string>,\n): { imports: Array<ImportEntry>; aliases: Map<string, string> } {\n const reservedNameSet = new Set(reservedNames)\n const aliases = new Map<string, string>()\n\n const aliasedImports = imports.map((entry) => {\n const names = Array.isArray(entry.name) ? entry.name : [entry.name]\n const aliasedNames = names.map((item): ImportName => {\n if (typeof item !== 'string' || !reservedNameSet.has(item)) {\n return item\n }\n\n const alias = `${item}Schema`\n aliases.set(item, alias)\n\n return { propertyName: item, name: alias }\n })\n\n return aliasedNames.some((item) => typeof item === 'object' && item.name)\n ? {\n ...entry,\n name: aliasedNames,\n }\n : entry\n })\n\n return {\n imports: aliasedImports,\n aliases,\n }\n}\n\n/**\n * Replaces all occurrences of original names with their aliased versions in the given text.\n */\nexport function rewriteAliasedImports(text: string, aliases: ReadonlyMap<string, string>): string {\n return Array.from(aliases).reduce((acc, [name, alias]) => acc.replace(new RegExp(`\\\\b${escapeRegExp(name)}\\\\b`, 'g'), alias), text)\n}\n\n/**\n * Resolves a type reference, determining if it needs an import statement or inline type reference.\n * Takes into account whether the type can be overridden and the file paths.\n */\nexport function resolveTypeReference({\n node,\n canOverride,\n name,\n typeName,\n filePath,\n typeFilePath,\n}: {\n node: ast.SchemaNode\n canOverride: boolean\n name: string\n typeName: string\n filePath: string\n typeFilePath: string\n}): { importPath?: string; typeName: string } {\n const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!usesTypeName) {\n return { typeName }\n }\n\n if (name === typeName) {\n return {\n typeName: `import('${toRelativeImportPath(filePath, typeFilePath)}').${typeName}`,\n }\n }\n\n return {\n importPath: typeFilePath,\n typeName,\n }\n}\n\n/**\n * Maps a schema node type to its corresponding scalar type representation.\n * Returns the type name for enums or the base type (string, number, etc.) for primitives.\n */\nexport function getScalarType(node: ast.SchemaNode, typeName: string): string {\n switch (node.type) {\n case 'string':\n case 'email':\n case 'url':\n case 'uuid':\n return 'string'\n case 'number':\n case 'integer':\n return 'number'\n case 'bigint':\n return 'bigint'\n case 'boolean':\n return 'boolean'\n case 'date':\n case 'time':\n return node.representation === 'date' ? 'Date' : 'string'\n case 'datetime':\n return 'string'\n case 'blob':\n return 'Blob'\n case 'enum':\n return typeName\n default:\n return typeName\n }\n}\n\n/**\n * Resolves faker type usage information for a schema.\n * Determines the data type, return type, and whether it uses the type name.\n */\nexport function resolveFakerTypeUsage(\n node: ast.SchemaNode,\n typeName: string,\n canOverride: boolean,\n): {\n dataType: string\n returnType: string | undefined\n usesTypeName: boolean\n} {\n const isArray = ARRAY_TYPES.has(node.type)\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n\n let dataType = `Partial<${typeName}>`\n\n if (isArray || isTuple || node.type === 'union' || node.type === 'enum') {\n dataType = typeName\n }\n\n if (isScalar) {\n dataType = getScalarType(node, typeName)\n }\n\n let returnType = canOverride ? typeName : undefined\n\n if (isScalar) {\n returnType = getScalarType(node, typeName)\n }\n\n return {\n dataType,\n returnType,\n usesTypeName: dataType.includes(typeName) || Boolean(returnType?.includes(typeName)),\n }\n}\n","import { jsStringEscape } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterFakerFactory } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { resolveFakerTypeUsage } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.SchemaNode\n printer: ast.Printer<PrinterFakerFactory>\n seed?: PluginFaker['options']['seed']\n description?: string\n canOverride: boolean\n}\n\nconst OBJECT_TYPES = new Set<ast.SchemaNode['type']>(['object', 'intersection'])\nconst ARRAY_TYPES = new Set<ast.SchemaNode['type']>(['array'])\nconst SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function Faker({ node, description, name, typeName, printer, seed, canOverride }: Props): KubbReactNode {\n const fakerText = printer.print(node) ?? 'undefined'\n\n const isArray = ARRAY_TYPES.has(node.type)\n const isObject = OBJECT_TYPES.has(node.type)\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n\n let fakerTextWithOverride = fakerText\n let useGenericOverride = false\n\n if (canOverride && isObject) {\n useGenericOverride = true\n }\n\n if (canOverride && isTuple) {\n fakerTextWithOverride = `data || ${fakerText}`\n }\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...(data || [])\n]`\n }\n\n if (canOverride && isScalar) {\n fakerTextWithOverride = `data ?? ${fakerText}`\n }\n\n const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n let functionSignature = ''\n let functionBody = ''\n\n if (useGenericOverride) {\n // Generate function with defaultFakeData structure\n const jsdoc = description ? `/**\\n * @description ${jsStringEscape(description)}\\n */\\n ` : ''\n functionSignature = `${jsdoc}export function ${name}(data?: Partial<${typeName}>): Required<${typeName}>`\n\n const seedCode = seed ? `faker.seed(${JSON.stringify(seed)})\\n ` : ''\n\n // When the object node has properties that transitively reference a cyclic schema,\n // the printer emits memoizing getters for those properties. Spreading the object\n // literal would immediately invoke those getters, triggering recursive faker calls\n // and causing a stack overflow. Detect this upfront via ast helpers so we can\n // use Object.defineProperty-based merging instead of spread.\n const { cyclicSchemas, schemaName } = printer.options\n const hasGetters =\n node.type === 'object' &&\n !!cyclicSchemas &&\n (node.properties ?? []).some((p) => ast.containsCircularRef(p.schema, { circularSchemas: cyclicSchemas, excludeName: schemaName }))\n\n if (hasGetters) {\n functionBody = `{\n ${seedCode}const defaultFakeData = ${fakerText}\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })\n }\n }\n return defaultFakeData as Required<${typeName}>\n}`\n } else {\n functionBody = `{\n ${seedCode}const defaultFakeData = ${fakerText}\n return {\n ...defaultFakeData,\n ...(data || {}),\n } as Required<${typeName}>\n}`\n }\n } else {\n const usesData = /\\bdata\\b/.test(fakerTextWithOverride)\n const dataParamName = usesData ? 'data' : '_data'\n const params = ast.createFunctionParameters({\n params: [\n ast.createFunctionParameter({\n name: dataParamName,\n type: ast.createParamsType({ variant: 'reference', name: dataType }),\n optional: true,\n }),\n ],\n })\n const paramsSignature = declarationPrinter.print(params) ?? ''\n const returnType = resolvedReturnType\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsStringEscape(description)}`] : [] }}\n params={canOverride ? paramsSignature : undefined}\n returnType={returnType}\n >\n {seed ? (\n <>\n {`faker.seed(${JSON.stringify(seed)})`}\n <br />\n </>\n ) : undefined}\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {functionSignature}\n {functionBody}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,IACnG,QAAO,KAAK,MAAM,GAAG,GAAG;;AAG5B,QAAO;;;;;;;;;;;;;AA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M;IACN,OAAO,EAAE,UAAU,cAAc,CAAC,gBAAgB,eAAe,YAAY,GAAG,GAAG,EAAE,EAAE;IACvF,QAAQ,cAAc,kBAAkB,KAAA;IAC5B;cALd,CAOG,OACC,qBAAA,UAAA,EAAA,UAAA,CACG,cAAc,KAAK,UAAU,KAAK,CAAC,IACpC,oBAAC,MAAD,EAAM,CAAA,CACL,EAAA,CAAA,GACD,KAAA,GACH,UAAU,wBACF;;GACC,CAAA;;AAIlB,QACE,qBAAC,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YAAtC,CACG,mBACA,aACW"}
|
package/dist/components.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
exports.Faker =
|
|
2
|
+
const require_Faker = require("./Faker-BgleOzVN.cjs");
|
|
3
|
+
exports.Faker = require_Faker.Faker;
|
package/dist/components.d.ts
CHANGED
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
import { Schema } from "@kubb/plugin-oas";
|
|
4
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
-
|
|
6
|
-
//#region src/components/Faker.d.ts
|
|
7
|
-
type Props = {
|
|
8
|
-
name: string;
|
|
9
|
-
typeName: string;
|
|
10
|
-
tree: Array<Schema>;
|
|
11
|
-
seed?: PluginFaker['options']['seed'];
|
|
12
|
-
description?: string;
|
|
13
|
-
regexGenerator?: PluginFaker['options']['regexGenerator'];
|
|
14
|
-
mapper?: PluginFaker['options']['mapper'];
|
|
15
|
-
dateParser?: PluginFaker['options']['dateParser'];
|
|
16
|
-
canOverride: boolean;
|
|
17
|
-
};
|
|
18
|
-
declare function Faker({
|
|
19
|
-
tree,
|
|
20
|
-
description,
|
|
21
|
-
name,
|
|
22
|
-
typeName,
|
|
23
|
-
seed,
|
|
24
|
-
regexGenerator,
|
|
25
|
-
canOverride,
|
|
26
|
-
mapper,
|
|
27
|
-
dateParser
|
|
28
|
-
}: Props): FabricReactNode;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { Faker };
|
|
31
|
-
//# sourceMappingURL=components.d.ts.map
|
|
1
|
+
import { t as Faker } from "./Faker-CdyPfOPg.js";
|
|
2
|
+
export { Faker };
|
package/dist/components.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Faker } from "./
|
|
1
|
+
import { t as Faker } from "./Faker-fcQEB9i5.js";
|
|
2
2
|
export { Faker };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { o as PluginFaker } from "./printerFaker-CJiwzoto.js";
|
|
3
|
+
import * as _$_kubb_core0 from "@kubb/core";
|
|
4
|
+
|
|
5
|
+
//#region src/generators/fakerGenerator.d.ts
|
|
6
|
+
declare const fakerGenerator: _$_kubb_core0.Generator<PluginFaker, unknown>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { fakerGenerator as t };
|
|
9
|
+
//# sourceMappingURL=fakerGenerator-C3Ho3BaI.d.ts.map
|