@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.cjs
CHANGED
|
@@ -135,7 +135,7 @@ const reservedWords = /* @__PURE__ */ new Set([
|
|
|
135
135
|
*/
|
|
136
136
|
function isValidVarName(name) {
|
|
137
137
|
if (!name || reservedWords.has(name)) return false;
|
|
138
|
-
return
|
|
138
|
+
return isIdentifier(name);
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Returns `name` when it's a syntactically valid JavaScript variable name,
|
|
@@ -488,7 +488,6 @@ const SCALAR_TYPES$1 = /* @__PURE__ */ new Set([
|
|
|
488
488
|
"blob",
|
|
489
489
|
"enum"
|
|
490
490
|
]);
|
|
491
|
-
const ARRAY_TYPES$1 = /* @__PURE__ */ new Set(["array"]);
|
|
492
491
|
function toRelativeImportPath(from, to) {
|
|
493
492
|
const relativePath = node_path.posix.relative(node_path.posix.dirname(from), to);
|
|
494
493
|
return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
|
|
@@ -533,7 +532,7 @@ function getScalarType(node, typeName) {
|
|
|
533
532
|
* Determines the data type, return type, and whether it uses the type name.
|
|
534
533
|
*/
|
|
535
534
|
function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
536
|
-
const isArray =
|
|
535
|
+
const isArray = node.type === "array";
|
|
537
536
|
const isTuple = node.type === "tuple";
|
|
538
537
|
const isScalar = SCALAR_TYPES$1.has(node.type);
|
|
539
538
|
let dataType = `Partial<${typeName}>`;
|
|
@@ -550,7 +549,6 @@ function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
|
550
549
|
//#endregion
|
|
551
550
|
//#region src/components/Faker.tsx
|
|
552
551
|
const OBJECT_TYPES = /* @__PURE__ */ new Set(["object", "intersection"]);
|
|
553
|
-
const ARRAY_TYPES = /* @__PURE__ */ new Set(["array"]);
|
|
554
552
|
const SCALAR_TYPES = /* @__PURE__ */ new Set([
|
|
555
553
|
"string",
|
|
556
554
|
"email",
|
|
@@ -569,7 +567,7 @@ const SCALAR_TYPES = /* @__PURE__ */ new Set([
|
|
|
569
567
|
const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
570
568
|
function Faker({ node, description, name, typeName, printer, seed, canOverride }) {
|
|
571
569
|
const fakerText = printer.print(node) ?? "undefined";
|
|
572
|
-
const isArray =
|
|
570
|
+
const isArray = node.type === "array";
|
|
573
571
|
const isObject = OBJECT_TYPES.has(node.type);
|
|
574
572
|
const isTuple = node.type === "tuple";
|
|
575
573
|
const isScalar = SCALAR_TYPES.has(node.type);
|