@fangzhongya/vue-archive 0.0.32 → 0.0.33

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