@fangzhongya/vue-archive 0.0.32 → 0.0.34
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/node/index.cjs
CHANGED
|
@@ -3138,35 +3138,63 @@ function getTypeValue(arr) {
|
|
|
3138
3138
|
return "undefined";
|
|
3139
3139
|
}
|
|
3140
3140
|
}
|
|
3141
|
-
function
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3141
|
+
function setDataType(arr) {
|
|
3142
|
+
return arr.join("|") || "any";
|
|
3143
|
+
}
|
|
3144
|
+
var splitIgnoringNesting = (str, delimiter) => {
|
|
3145
|
+
let bracketStack = [];
|
|
3146
|
+
let parts = [];
|
|
3147
|
+
let current = "";
|
|
3148
|
+
for (let i = 0; i < str.length; i++) {
|
|
3149
|
+
const char = str[i];
|
|
3150
|
+
if (char === "[" || char === "<" || char === "(") {
|
|
3151
|
+
bracketStack.push(char);
|
|
3152
|
+
current += char;
|
|
3153
|
+
} else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
|
|
3154
|
+
bracketStack.pop();
|
|
3155
|
+
current += char;
|
|
3156
|
+
} else if (char === delimiter && bracketStack.length === 0) {
|
|
3157
|
+
parts.push(current.trim());
|
|
3158
|
+
current = "";
|
|
3148
3159
|
} else {
|
|
3149
|
-
|
|
3150
|
-
let rts = reg.exec(str);
|
|
3151
|
-
if (rts && rts.length > 0) {
|
|
3152
|
-
let ass = rts[1];
|
|
3153
|
-
arr = ass.split("|");
|
|
3154
|
-
} else {
|
|
3155
|
-
arr = ["any"];
|
|
3156
|
-
}
|
|
3160
|
+
current += char;
|
|
3157
3161
|
}
|
|
3162
|
+
}
|
|
3163
|
+
if (current.trim() !== "") {
|
|
3164
|
+
parts.push(current.trim());
|
|
3165
|
+
}
|
|
3166
|
+
return parts;
|
|
3167
|
+
};
|
|
3168
|
+
var parseTypeDefinition = (typeDef) => {
|
|
3169
|
+
if (!typeDef) {
|
|
3170
|
+
return { type: "any", dataType: ["any"] };
|
|
3171
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
|
|
3172
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3173
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3174
|
+
const types = splitIgnoringNesting(inner, ",");
|
|
3175
|
+
return {
|
|
3176
|
+
type: types[0] || "any",
|
|
3177
|
+
dataType: types
|
|
3178
|
+
};
|
|
3179
|
+
} else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
|
|
3180
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3181
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3182
|
+
const types = splitIgnoringNesting(inner, "|");
|
|
3183
|
+
return {
|
|
3184
|
+
type: types[0] || "any",
|
|
3185
|
+
dataType: types
|
|
3186
|
+
};
|
|
3158
3187
|
} else {
|
|
3159
|
-
|
|
3188
|
+
return {
|
|
3189
|
+
type: typeDef,
|
|
3190
|
+
dataType: [typeDef]
|
|
3191
|
+
};
|
|
3160
3192
|
}
|
|
3161
|
-
|
|
3162
|
-
}
|
|
3163
|
-
function setDataType(arr) {
|
|
3164
|
-
return arr.join("|") || "any";
|
|
3165
|
-
}
|
|
3193
|
+
};
|
|
3166
3194
|
function parseParamString(input) {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
const label = trimmedPart;
|
|
3195
|
+
const parts = splitIgnoringNesting(input, ",");
|
|
3196
|
+
return parts.map((trimmedPart) => {
|
|
3197
|
+
const label = trimmedPart.trim();
|
|
3170
3198
|
const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
|
|
3171
3199
|
if (!nameMatch) return null;
|
|
3172
3200
|
const name = nameMatch[1].trim();
|
|
@@ -3174,7 +3202,6 @@ function parseParamString(input) {
|
|
|
3174
3202
|
const typeDefStart = nameMatch[0].length;
|
|
3175
3203
|
const typeDef = trimmedPart.substring(typeDefStart).trim();
|
|
3176
3204
|
let bracketStack = [];
|
|
3177
|
-
let endIndex = -1;
|
|
3178
3205
|
let t = "";
|
|
3179
3206
|
let description = "";
|
|
3180
3207
|
for (let i = 0; i < typeDef.length; i++) {
|
|
@@ -3185,18 +3212,23 @@ function parseParamString(input) {
|
|
|
3185
3212
|
bracketStack.pop();
|
|
3186
3213
|
}
|
|
3187
3214
|
if (bracketStack.length === 0 && i > 0) {
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3215
|
+
if (i == 1 && char !== "]" && char !== ">" && char !== ")") {
|
|
3216
|
+
t = "";
|
|
3217
|
+
description = typeDef.substring(0);
|
|
3218
|
+
} else {
|
|
3219
|
+
t = typeDef.substring(0, i + 1).trim();
|
|
3220
|
+
description = typeDef.substring(i + 1);
|
|
3221
|
+
}
|
|
3191
3222
|
break;
|
|
3192
3223
|
}
|
|
3193
3224
|
}
|
|
3194
|
-
|
|
3225
|
+
const { type, dataType } = parseTypeDefinition(t);
|
|
3226
|
+
const tarr = getSonType(dataType);
|
|
3195
3227
|
return {
|
|
3196
3228
|
name,
|
|
3197
3229
|
prop: name,
|
|
3198
3230
|
type: tarr[0],
|
|
3199
|
-
dataType
|
|
3231
|
+
dataType,
|
|
3200
3232
|
must,
|
|
3201
3233
|
label,
|
|
3202
3234
|
description
|
|
@@ -3421,7 +3453,7 @@ function setValStringify(v, key, propsText) {
|
|
|
3421
3453
|
}
|
|
3422
3454
|
}
|
|
3423
3455
|
function getSpecType(val) {
|
|
3424
|
-
let tarr =
|
|
3456
|
+
let tarr = getType(val?.type);
|
|
3425
3457
|
let type = "any";
|
|
3426
3458
|
if (tarr.length == 1) {
|
|
3427
3459
|
type = tarr[0].split("<")[0];
|
|
@@ -3454,7 +3486,7 @@ function getSpecType(val) {
|
|
|
3454
3486
|
dataType: tarr
|
|
3455
3487
|
};
|
|
3456
3488
|
}
|
|
3457
|
-
function
|
|
3489
|
+
function getType(value) {
|
|
3458
3490
|
let arr = [];
|
|
3459
3491
|
let str = (value || "").trim().toLowerCase();
|
|
3460
3492
|
str.split(",").forEach((v) => {
|
package/dist/node/index.js
CHANGED
|
@@ -3123,35 +3123,63 @@ function getTypeValue(arr) {
|
|
|
3123
3123
|
return "undefined";
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3126
|
+
function setDataType(arr) {
|
|
3127
|
+
return arr.join("|") || "any";
|
|
3128
|
+
}
|
|
3129
|
+
var splitIgnoringNesting = (str, delimiter) => {
|
|
3130
|
+
let bracketStack = [];
|
|
3131
|
+
let parts = [];
|
|
3132
|
+
let current = "";
|
|
3133
|
+
for (let i = 0; i < str.length; i++) {
|
|
3134
|
+
const char = str[i];
|
|
3135
|
+
if (char === "[" || char === "<" || char === "(") {
|
|
3136
|
+
bracketStack.push(char);
|
|
3137
|
+
current += char;
|
|
3138
|
+
} else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
|
|
3139
|
+
bracketStack.pop();
|
|
3140
|
+
current += char;
|
|
3141
|
+
} else if (char === delimiter && bracketStack.length === 0) {
|
|
3142
|
+
parts.push(current.trim());
|
|
3143
|
+
current = "";
|
|
3133
3144
|
} else {
|
|
3134
|
-
|
|
3135
|
-
let rts = reg.exec(str);
|
|
3136
|
-
if (rts && rts.length > 0) {
|
|
3137
|
-
let ass = rts[1];
|
|
3138
|
-
arr = ass.split("|");
|
|
3139
|
-
} else {
|
|
3140
|
-
arr = ["any"];
|
|
3141
|
-
}
|
|
3145
|
+
current += char;
|
|
3142
3146
|
}
|
|
3147
|
+
}
|
|
3148
|
+
if (current.trim() !== "") {
|
|
3149
|
+
parts.push(current.trim());
|
|
3150
|
+
}
|
|
3151
|
+
return parts;
|
|
3152
|
+
};
|
|
3153
|
+
var parseTypeDefinition = (typeDef) => {
|
|
3154
|
+
if (!typeDef) {
|
|
3155
|
+
return { type: "any", dataType: ["any"] };
|
|
3156
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
|
|
3157
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3158
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3159
|
+
const types = splitIgnoringNesting(inner, ",");
|
|
3160
|
+
return {
|
|
3161
|
+
type: types[0] || "any",
|
|
3162
|
+
dataType: types
|
|
3163
|
+
};
|
|
3164
|
+
} else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
|
|
3165
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3166
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3167
|
+
const types = splitIgnoringNesting(inner, "|");
|
|
3168
|
+
return {
|
|
3169
|
+
type: types[0] || "any",
|
|
3170
|
+
dataType: types
|
|
3171
|
+
};
|
|
3143
3172
|
} else {
|
|
3144
|
-
|
|
3173
|
+
return {
|
|
3174
|
+
type: typeDef,
|
|
3175
|
+
dataType: [typeDef]
|
|
3176
|
+
};
|
|
3145
3177
|
}
|
|
3146
|
-
|
|
3147
|
-
}
|
|
3148
|
-
function setDataType(arr) {
|
|
3149
|
-
return arr.join("|") || "any";
|
|
3150
|
-
}
|
|
3178
|
+
};
|
|
3151
3179
|
function parseParamString(input) {
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
const label = trimmedPart;
|
|
3180
|
+
const parts = splitIgnoringNesting(input, ",");
|
|
3181
|
+
return parts.map((trimmedPart) => {
|
|
3182
|
+
const label = trimmedPart.trim();
|
|
3155
3183
|
const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
|
|
3156
3184
|
if (!nameMatch) return null;
|
|
3157
3185
|
const name = nameMatch[1].trim();
|
|
@@ -3159,7 +3187,6 @@ function parseParamString(input) {
|
|
|
3159
3187
|
const typeDefStart = nameMatch[0].length;
|
|
3160
3188
|
const typeDef = trimmedPart.substring(typeDefStart).trim();
|
|
3161
3189
|
let bracketStack = [];
|
|
3162
|
-
let endIndex = -1;
|
|
3163
3190
|
let t = "";
|
|
3164
3191
|
let description = "";
|
|
3165
3192
|
for (let i = 0; i < typeDef.length; i++) {
|
|
@@ -3170,18 +3197,23 @@ function parseParamString(input) {
|
|
|
3170
3197
|
bracketStack.pop();
|
|
3171
3198
|
}
|
|
3172
3199
|
if (bracketStack.length === 0 && i > 0) {
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3200
|
+
if (i == 1 && char !== "]" && char !== ">" && char !== ")") {
|
|
3201
|
+
t = "";
|
|
3202
|
+
description = typeDef.substring(0);
|
|
3203
|
+
} else {
|
|
3204
|
+
t = typeDef.substring(0, i + 1).trim();
|
|
3205
|
+
description = typeDef.substring(i + 1);
|
|
3206
|
+
}
|
|
3176
3207
|
break;
|
|
3177
3208
|
}
|
|
3178
3209
|
}
|
|
3179
|
-
|
|
3210
|
+
const { type, dataType } = parseTypeDefinition(t);
|
|
3211
|
+
const tarr = getSonType(dataType);
|
|
3180
3212
|
return {
|
|
3181
3213
|
name,
|
|
3182
3214
|
prop: name,
|
|
3183
3215
|
type: tarr[0],
|
|
3184
|
-
dataType
|
|
3216
|
+
dataType,
|
|
3185
3217
|
must,
|
|
3186
3218
|
label,
|
|
3187
3219
|
description
|
|
@@ -3406,7 +3438,7 @@ function setValStringify(v, key, propsText) {
|
|
|
3406
3438
|
}
|
|
3407
3439
|
}
|
|
3408
3440
|
function getSpecType(val) {
|
|
3409
|
-
let tarr =
|
|
3441
|
+
let tarr = getType(val?.type);
|
|
3410
3442
|
let type = "any";
|
|
3411
3443
|
if (tarr.length == 1) {
|
|
3412
3444
|
type = tarr[0].split("<")[0];
|
|
@@ -3439,7 +3471,7 @@ function getSpecType(val) {
|
|
|
3439
3471
|
dataType: tarr
|
|
3440
3472
|
};
|
|
3441
3473
|
}
|
|
3442
|
-
function
|
|
3474
|
+
function getType(value) {
|
|
3443
3475
|
let arr = [];
|
|
3444
3476
|
let str = (value || "").trim().toLowerCase();
|
|
3445
3477
|
str.split(",").forEach((v) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),v=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function w(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function O(e){return y(e)}function A(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
|
|
2
|
+
`)}function m(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
|
|
3
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?m(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?v.firstLower(e):e}function x(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function d(e,n){let t=x(e);t?(n.push(t.own),t.son&&d(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&d(e,n),n}function T(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function q(e,n){const t=T(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function B(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function E(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let n="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?n="string":/^\[(.|\n|\r)*\]$/.test(e)?n="array":/^\{(.|\n|\r)*\}$/.test(e)?n="object":/^[0-9]*$/.test(e)?n="number":e==="true"||e==="false"?n="boolean":e=="undefined"?n="undefined":e=="null"?n="null":e&&(n="string"),n}function j(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let t=j(e.splice(1));return t=t=="undefined"?"":t,`[${t}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function L(e){return e.join("|")||"any"}const g=(e,n)=>{let t=[],r=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},C=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,"|");return{type:t[0]||"any",dataType:t}}else return{type:e,dataType:[e]};else return{type:"any",dataType:["any"]}};function M(e){return g(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],F=i[0].length,c=t.substring(F).trim();let a=[],f="",p="";for(let l=0;l<c.length;l++){const o=c[l];if(o==="["||o==="<"||o==="("?a.push(o):(o==="]"&&a[a.length-1]==="["||o===">"&&a[a.length-1]==="<"||o===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&l>0){l==1&&o!=="]"&&o!==">"&&o!==")"?(f="",p=c.substring(0)):(f=c.substring(0,l+1).trim(),p=c.substring(l+1));break}}const{type:N,dataType:b}=C(f),$=h(b);return{name:u,prop:u,type:$[0],dataType:b,must:s,label:r,description:p}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>S.getFunctionFormat});exports.getFunBody=m;exports.getObjType=T;exports.getSonType=h;exports.getString=B;exports.getTypeValue=j;exports.isDefaultType=E;exports.isTypeEqual=q;exports.parseParamString=M;exports.prettierArrFormat=O;exports.prettierFormat=y;exports.prettierObjFormat=w;exports.setDataType=L;exports.vueFormat=A;
|
|
@@ -37,14 +37,6 @@ export declare function getString(st: unknown): string;
|
|
|
37
37
|
export declare function isDefaultType(st: string): string;
|
|
38
38
|
export declare function getTypeValue(arr: string[]): string;
|
|
39
39
|
export declare function setDataType(arr: string[]): string;
|
|
40
|
-
export declare function getParametersObj(cs: string): {
|
|
41
|
-
label: string;
|
|
42
|
-
prop: string;
|
|
43
|
-
must: boolean;
|
|
44
|
-
type: string;
|
|
45
|
-
dataType: string[];
|
|
46
|
-
description: string;
|
|
47
|
-
}[];
|
|
48
40
|
export declare function parseParamString(input: string): Array<{
|
|
49
41
|
name: string;
|
|
50
42
|
prop: string;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { getFunctionFormat as
|
|
2
|
-
import { firstLower as
|
|
3
|
-
function
|
|
1
|
+
import { getFunctionFormat as M } from "@fangzhongya/utils/basic/string/toFunction";
|
|
2
|
+
import { firstLower as $ } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
|
+
function h(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return e = "let a = " + e,
|
|
6
|
+
function O(e) {
|
|
7
|
+
return e = "let a = " + e, h(e).replace(/^let a = /, "");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function B(e) {
|
|
10
|
+
return h(e);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
return
|
|
12
|
+
function E(e, n = "") {
|
|
13
|
+
let t = (e + "").trim().split(/\n/);
|
|
14
|
+
return t = t.map((r) => n + r), t.join(`
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function j(e = "") {
|
|
18
18
|
e = e.trim();
|
|
19
|
-
let
|
|
20
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" +
|
|
21
|
-
return r && r.length > 0 ?
|
|
19
|
+
let n = `[\\s|\\n|\\r]*\\{((.|
|
|
20
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" + n + "$").exec(e);
|
|
21
|
+
return r && r.length > 0 ? j(r[1]) : e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const S = [
|
|
24
24
|
"Boolean",
|
|
25
25
|
"Any",
|
|
26
26
|
"String",
|
|
@@ -29,47 +29,47 @@ const x = [
|
|
|
29
29
|
"Object",
|
|
30
30
|
"Function"
|
|
31
31
|
];
|
|
32
|
-
function m(e) {
|
|
33
|
-
return x.includes(e) ? j(e) : e;
|
|
34
|
-
}
|
|
35
32
|
function w(e) {
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
return S.includes(e) ? $(e) : e;
|
|
34
|
+
}
|
|
35
|
+
function F(e) {
|
|
36
|
+
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
|
+
if (t && t.length > 0)
|
|
38
38
|
return {
|
|
39
|
-
own:
|
|
40
|
-
son:
|
|
39
|
+
own: w(t[1]),
|
|
40
|
+
son: t[2]
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
|
|
43
|
+
function m(e, n) {
|
|
44
|
+
let t = F(e);
|
|
45
|
+
t ? (n.push(t.own), t.son && m(t.son, n)) : n.push(e);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function b(e) {
|
|
48
48
|
e instanceof Array && (e = e[0]);
|
|
49
|
-
const
|
|
50
|
-
return e &&
|
|
49
|
+
const n = [];
|
|
50
|
+
return e && m(e, n), n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
let r = /^\[[O|o]bject (.*)\]$/.exec(
|
|
55
|
-
return r && r.length > 0 && (
|
|
52
|
+
function v(e) {
|
|
53
|
+
const n = Object.prototype.toString.call(e);
|
|
54
|
+
let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
|
|
55
|
+
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
return r && r != "any" ?
|
|
57
|
+
function L(e, n) {
|
|
58
|
+
const t = v(e), r = b(n)[0];
|
|
59
|
+
return r && r != "any" ? t == r : !0;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function C(e) {
|
|
62
62
|
if (typeof e == "string") {
|
|
63
|
-
let
|
|
64
|
-
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (
|
|
63
|
+
let n = !1;
|
|
64
|
+
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (n = !0), n && (e = e.substring(1, e.length - 1)), e + "";
|
|
65
65
|
} else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function N(e) {
|
|
68
68
|
e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
|
|
69
|
-
let
|
|
70
|
-
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ?
|
|
69
|
+
let n = "";
|
|
70
|
+
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? n = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? n = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? n = "object" : /^[0-9]*$/.test(e) ? n = "number" : e === "true" || e === "false" ? n = "boolean" : e == "undefined" ? n = "undefined" : e == "null" ? n = "null" : e && (n = "string"), n;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function x(e) {
|
|
73
73
|
switch ((e[0] || "any").toLowerCase()) {
|
|
74
74
|
case "string":
|
|
75
75
|
return '""';
|
|
@@ -78,8 +78,8 @@ function S(e) {
|
|
|
78
78
|
case "number":
|
|
79
79
|
return "0";
|
|
80
80
|
case "array":
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let t = x(e.splice(1));
|
|
82
|
+
return t = t == "undefined" ? "" : t, `[${t}]`;
|
|
83
83
|
case "object":
|
|
84
84
|
return "{}";
|
|
85
85
|
case "function":
|
|
@@ -90,60 +90,79 @@ function S(e) {
|
|
|
90
90
|
return "undefined";
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
let t = [];
|
|
95
|
-
if (e)
|
|
96
|
-
if (e = (e + "").trim(), e.startsWith("["))
|
|
97
|
-
e = e.substring(1, e.lastIndexOf("]")), t = e.split(",");
|
|
98
|
-
else {
|
|
99
|
-
let r = /^\<([a-z|\<|\>|\|]+)\>/.exec(e);
|
|
100
|
-
r && r.length > 0 ? t = r[1].split("|") : t = ["any"];
|
|
101
|
-
}
|
|
102
|
-
else
|
|
103
|
-
t = ["any"];
|
|
104
|
-
return t.map((n) => m(n));
|
|
105
|
-
}
|
|
106
|
-
function z(e) {
|
|
93
|
+
function R(e) {
|
|
107
94
|
return e.join("|") || "any";
|
|
108
95
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
96
|
+
const g = (e, n) => {
|
|
97
|
+
let t = [], r = [], i = "";
|
|
98
|
+
for (let a = 0; a < e.length; a++) {
|
|
99
|
+
const s = e[a];
|
|
100
|
+
s === "[" || s === "<" || s === "(" ? (t.push(s), i += s) : s === "]" && t.length > 0 && t[t.length - 1] === "[" || s === ">" && t.length > 0 && t[t.length - 1] === "<" || s === ")" && t.length > 0 && t[t.length - 1] === "(" ? (t.pop(), i += s) : s === n && t.length === 0 ? (r.push(i.trim()), i = "") : i += s;
|
|
101
|
+
}
|
|
102
|
+
return i.trim() !== "" && r.push(i.trim()), r;
|
|
103
|
+
}, W = (e) => {
|
|
104
|
+
if (e)
|
|
105
|
+
if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
|
|
106
|
+
const n = e.slice(1, -1).trim();
|
|
107
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
108
|
+
const t = g(n, ",");
|
|
109
|
+
return {
|
|
110
|
+
type: t[0] || "any",
|
|
111
|
+
dataType: t
|
|
112
|
+
};
|
|
113
|
+
} else if (e.startsWith("<") && e.endsWith(">")) {
|
|
114
|
+
const n = e.slice(1, -1).trim();
|
|
115
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
116
|
+
const t = g(n, "|");
|
|
117
|
+
return {
|
|
118
|
+
type: t[0] || "any",
|
|
119
|
+
dataType: t
|
|
120
|
+
};
|
|
121
|
+
} else
|
|
122
|
+
return {
|
|
123
|
+
type: e,
|
|
124
|
+
dataType: [e]
|
|
125
|
+
};
|
|
126
|
+
else return { type: "any", dataType: ["any"] };
|
|
127
|
+
};
|
|
128
|
+
function q(e) {
|
|
129
|
+
return g(e, ",").map((t) => {
|
|
130
|
+
const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
|
|
131
|
+
if (!i) return null;
|
|
132
|
+
const a = i[1].trim(), s = !i[2], d = i[0].length, c = t.substring(d).trim();
|
|
133
|
+
let l = [], f = "", p = "";
|
|
134
|
+
for (let u = 0; u < c.length; u++) {
|
|
135
|
+
const o = c[u];
|
|
136
|
+
if (o === "[" || o === "<" || o === "(" ? l.push(o) : (o === "]" && l[l.length - 1] === "[" || o === ">" && l[l.length - 1] === "<" || o === ")" && l[l.length - 1] === "(") && l.pop(), l.length === 0 && u > 0) {
|
|
137
|
+
u == 1 && o !== "]" && o !== ">" && o !== ")" ? (f = "", p = c.substring(0)) : (f = c.substring(0, u + 1).trim(), p = c.substring(u + 1));
|
|
119
138
|
break;
|
|
120
139
|
}
|
|
121
140
|
}
|
|
122
|
-
|
|
141
|
+
const { type: k, dataType: y } = W(f), T = b(y);
|
|
123
142
|
return {
|
|
124
143
|
name: a,
|
|
125
144
|
prop: a,
|
|
126
|
-
type:
|
|
127
|
-
dataType:
|
|
128
|
-
must:
|
|
145
|
+
type: T[0],
|
|
146
|
+
dataType: y,
|
|
147
|
+
must: s,
|
|
129
148
|
label: r,
|
|
130
149
|
description: p
|
|
131
150
|
};
|
|
132
151
|
}).filter(Boolean);
|
|
133
152
|
}
|
|
134
153
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
j as getFunBody,
|
|
155
|
+
M as getFunctionFormat,
|
|
156
|
+
v as getObjType,
|
|
157
|
+
b as getSonType,
|
|
158
|
+
C as getString,
|
|
159
|
+
x as getTypeValue,
|
|
160
|
+
N as isDefaultType,
|
|
161
|
+
L as isTypeEqual,
|
|
162
|
+
q as parseParamString,
|
|
163
|
+
B as prettierArrFormat,
|
|
164
|
+
h as prettierFormat,
|
|
165
|
+
O as prettierObjFormat,
|
|
166
|
+
R as setDataType,
|
|
167
|
+
E as vueFormat
|
|
149
168
|
};
|