@kubb/plugin-faker 3.0.0-alpha.11 → 3.0.0-alpha.13
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/README.md +13 -0
- package/dist/components.cjs +21 -19
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +21 -19
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +21 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -19
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/components/OperationSchema.tsx +0 -1
- package/src/components/Schema.tsx +18 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.13",
|
|
4
4
|
"description": "Generator plugin-faker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -53,25 +53,25 @@
|
|
|
53
53
|
"!/**/__tests__/**"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@kubb/core": "3.0.0-alpha.
|
|
57
|
-
"@kubb/fs": "3.0.0-alpha.
|
|
58
|
-
"@kubb/oas": "3.0.0-alpha.
|
|
59
|
-
"@kubb/parser-ts": "3.0.0-alpha.
|
|
60
|
-
"@kubb/plugin-oas": "3.0.0-alpha.
|
|
61
|
-
"@kubb/plugin-ts": "3.0.0-alpha.
|
|
62
|
-
"@kubb/react": "3.0.0-alpha.
|
|
56
|
+
"@kubb/core": "3.0.0-alpha.13",
|
|
57
|
+
"@kubb/fs": "3.0.0-alpha.13",
|
|
58
|
+
"@kubb/oas": "3.0.0-alpha.13",
|
|
59
|
+
"@kubb/parser-ts": "3.0.0-alpha.13",
|
|
60
|
+
"@kubb/plugin-oas": "3.0.0-alpha.13",
|
|
61
|
+
"@kubb/plugin-ts": "3.0.0-alpha.13",
|
|
62
|
+
"@kubb/react": "3.0.0-alpha.13"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/react": "^18.3.5",
|
|
66
66
|
"react": "^18.3.1",
|
|
67
67
|
"tsup": "^8.2.4",
|
|
68
68
|
"typescript": "^5.5.4",
|
|
69
|
-
"@kubb/config-biome": "3.0.0-alpha.
|
|
70
|
-
"@kubb/config-ts": "3.0.0-alpha.
|
|
71
|
-
"@kubb/config-tsup": "3.0.0-alpha.
|
|
69
|
+
"@kubb/config-biome": "3.0.0-alpha.13",
|
|
70
|
+
"@kubb/config-ts": "3.0.0-alpha.13",
|
|
71
|
+
"@kubb/config-tsup": "3.0.0-alpha.13"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@kubb/react": "3.0.0-alpha.
|
|
74
|
+
"@kubb/react": "3.0.0-alpha.13"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=20"
|
|
@@ -74,7 +74,6 @@ OperationSchema.File = function ({}: FileProps): ReactNode {
|
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
76
|
<File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
|
|
77
|
-
<File.Import name={['faker']} path="@faker-js/faker" />
|
|
78
77
|
{plugin.options.regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}
|
|
79
78
|
{items.map(mapItem)}
|
|
80
79
|
</File>
|
|
@@ -65,21 +65,26 @@ export function Schema(props: Props): ReactNode {
|
|
|
65
65
|
|
|
66
66
|
const params = fakerDefaultOverride ? `data: NonNullable<Partial<${typeName}>> = ${fakerDefaultOverride}` : `data?: NonNullable<Partial<${typeName}>>`
|
|
67
67
|
|
|
68
|
+
const containsFaker = !!fakerTextWithOverride.match(/faker/) || !!seed
|
|
69
|
+
|
|
68
70
|
return (
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
<>
|
|
72
|
+
{containsFaker && <File.Import name={['faker']} path="@faker-js/faker" />}
|
|
73
|
+
<File.Source name={resolvedName} isExportable isIndexable>
|
|
74
|
+
<Function
|
|
75
|
+
export
|
|
76
|
+
name={resolvedName}
|
|
77
|
+
JSDoc={{ comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean) }}
|
|
78
|
+
params={withData ? params : ''}
|
|
79
|
+
returnType={typeName ? `NonNullable<${typeName}>` : ''}
|
|
80
|
+
>
|
|
81
|
+
{seed ? `faker.seed(${JSON.stringify(seed)})` : ''}
|
|
82
|
+
<br />
|
|
83
|
+
<Function.Return>{fakerTextWithOverride}</Function.Return>
|
|
84
|
+
</Function>
|
|
78
85
|
<br />
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<br />
|
|
82
|
-
</File.Source>
|
|
86
|
+
</File.Source>
|
|
87
|
+
</>
|
|
83
88
|
)
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -135,7 +140,6 @@ Schema.Imports = (): ReactNode => {
|
|
|
135
140
|
|
|
136
141
|
return (
|
|
137
142
|
<>
|
|
138
|
-
<File.Import name={['faker']} path="@faker-js/faker" />
|
|
139
143
|
{regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}
|
|
140
144
|
{dateParser && <File.Import path={dateParser} name={dateParser} />}
|
|
141
145
|
{typeName && typePath && <File.Import isTypeOnly root={root} path={typePath} name={[typeName]} />}
|