@kubb/plugin-faker 5.0.0-beta.85 → 5.0.0-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -131,7 +131,7 @@ const reservedWords = /* @__PURE__ */ new Set([
|
|
|
131
131
|
*/
|
|
132
132
|
function isValidVarName(name) {
|
|
133
133
|
if (!name || reservedWords.has(name)) return false;
|
|
134
|
-
return
|
|
134
|
+
return isIdentifier(name);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Returns `name` when it's a syntactically valid JavaScript variable name,
|
|
@@ -484,7 +484,6 @@ const SCALAR_TYPES$1 = /* @__PURE__ */ new Set([
|
|
|
484
484
|
"blob",
|
|
485
485
|
"enum"
|
|
486
486
|
]);
|
|
487
|
-
const ARRAY_TYPES$1 = /* @__PURE__ */ new Set(["array"]);
|
|
488
487
|
function toRelativeImportPath(from, to) {
|
|
489
488
|
const relativePath = posix.relative(posix.dirname(from), to);
|
|
490
489
|
return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
|
|
@@ -529,7 +528,7 @@ function getScalarType(node, typeName) {
|
|
|
529
528
|
* Determines the data type, return type, and whether it uses the type name.
|
|
530
529
|
*/
|
|
531
530
|
function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
532
|
-
const isArray =
|
|
531
|
+
const isArray = node.type === "array";
|
|
533
532
|
const isTuple = node.type === "tuple";
|
|
534
533
|
const isScalar = SCALAR_TYPES$1.has(node.type);
|
|
535
534
|
let dataType = `Partial<${typeName}>`;
|
|
@@ -546,7 +545,6 @@ function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
|
546
545
|
//#endregion
|
|
547
546
|
//#region src/components/Faker.tsx
|
|
548
547
|
const OBJECT_TYPES = /* @__PURE__ */ new Set(["object", "intersection"]);
|
|
549
|
-
const ARRAY_TYPES = /* @__PURE__ */ new Set(["array"]);
|
|
550
548
|
const SCALAR_TYPES = /* @__PURE__ */ new Set([
|
|
551
549
|
"string",
|
|
552
550
|
"email",
|
|
@@ -565,7 +563,7 @@ const SCALAR_TYPES = /* @__PURE__ */ new Set([
|
|
|
565
563
|
const declarationPrinter = functionPrinter({ mode: "declaration" });
|
|
566
564
|
function Faker({ node, description, name, typeName, printer, seed, canOverride }) {
|
|
567
565
|
const fakerText = printer.print(node) ?? "undefined";
|
|
568
|
-
const isArray =
|
|
566
|
+
const isArray = node.type === "array";
|
|
569
567
|
const isObject = OBJECT_TYPES.has(node.type);
|
|
570
568
|
const isTuple = node.type === "tuple";
|
|
571
569
|
const isScalar = SCALAR_TYPES.has(node.type);
|